Skip to content

Commit

Permalink
[vrouter_netns] Create netns if it's not exist
Browse files Browse the repository at this point in the history
If the script opencontrail-vrouter-netns is call with the '--uptae'
flag, the Linux network namespace is not initialized before it sets SNAT
or LBaaS stuff on it. So it fails. To resolve that, it create it if it's
not exist.

Change-Id: I74f87f3e7f1ebca1ac664d646d139a4f6eddbf98
Closes-Bug: #1466879
  • Loading branch information
Édouard Thuleau committed Jun 19, 2015
1 parent 937698c commit cc61f98
Showing 1 changed file with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,7 @@ def create(self):

def set_snat(self):
if not self.ip_ns.netns.exists(self.namespace):
raise ValueError('Need to create the network namespace before set '
'up the SNAT')
self.create()

self.ip_ns.netns.execute(['sysctl', '-w', 'net.ipv4.ip_forward=1'])
self.ip_ns.netns.execute(['iptables', '-t', 'nat', '-F'])
Expand Down Expand Up @@ -131,8 +130,7 @@ def set_snat(self):

def set_lbaas(self):
if not self.ip_ns.netns.exists(self.namespace):
raise ValueError('Need to create the network namespace before set '
'up the lbaas')
self.create()

haproxy_process.start_update_haproxy(self.cfg_file, self.namespace, True)

Expand Down

0 comments on commit cc61f98

Please sign in to comment.