summaryrefslogtreecommitdiff
path: root/cloudinit/net/__init__.py
diff options
context:
space:
mode:
authorScott Moser <smoser@ubuntu.com>2018-09-13 22:15:39 +0000
committerServer Team CI Bot <josh.powers+server-team-bot@canonical.com>2018-09-13 22:15:39 +0000
commit12066fc8f6518d294501aa126b5332ea90c4896c (patch)
treee49d5a92e7941eb984965a620825f6cd896b5711 /cloudinit/net/__init__.py
parent4361e0e42a34ebf9f49dde2356b7261715cf0cd5 (diff)
downloadvyos-cloud-init-12066fc8f6518d294501aa126b5332ea90c4896c.tar.gz
vyos-cloud-init-12066fc8f6518d294501aa126b5332ea90c4896c.zip
EphemeralIPv4Network: Be more explicit when adding default route.
On OpenStack based OVH public cloud, we got DHCP response with   fixed-address 54.36.113.86;   option subnet-mask 255.255.255.255;   option routers 54.36.112.1; The router clearly is not on the subnet. So 'ip' would fail when we tried to add the default route. The solution here is to add an explicit route on that interface to the router and then add the default route. Also add 'bgpovs' to the list of 'physical' types for OpenStack network configuration. That type is used on OVH public cloud. LP: #1792415
Diffstat (limited to 'cloudinit/net/__init__.py')
-rw-r--r--cloudinit/net/__init__.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/cloudinit/net/__init__.py b/cloudinit/net/__init__.py
index 3ffde52c..5e87bcad 100644
--- a/cloudinit/net/__init__.py
+++ b/cloudinit/net/__init__.py
@@ -698,6 +698,13 @@ class EphemeralIPv4Network(object):
self.interface, out.strip())
return
util.subp(
+ ['ip', '-4', 'route', 'add', self.router, 'dev', self.interface,
+ 'src', self.ip], capture=True)
+ self.cleanup_cmds.insert(
+ 0,
+ ['ip', '-4', 'route', 'del', self.router, 'dev', self.interface,
+ 'src', self.ip])
+ util.subp(
['ip', '-4', 'route', 'add', 'default', 'via', self.router,
'dev', self.interface], capture=True)
self.cleanup_cmds.insert(