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
(cherry picked from commit cc61f98)
  • Loading branch information
Édouard Thuleau committed Nov 17, 2015
1 parent ad5c1ad commit 2a36949
Showing 1 changed file with 2 additions and 4 deletions.
Expand Up @@ -102,8 +102,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 @@ -134,8 +133,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,
self.keystone_auth_cfg_file)
Expand Down

0 comments on commit 2a36949

Please sign in to comment.