summaryrefslogtreecommitdiff
path: root/cloudinit/net/network_state.py
diff options
context:
space:
mode:
authorAkihiko Ota <skywalker.37th@gmail.com>2018-03-20 11:41:26 -0600
committerChad Smith <chad.smith@canonical.com>2018-03-20 11:41:26 -0600
commit7deec7b6a1fce87dc2d9cd886053804bbc70380e (patch)
tree3bcf2bbb62f2e910a0a6f8fd7fdcefeedf49a237 /cloudinit/net/network_state.py
parente88e35483e373b39b4485f30f7a867f50571027c (diff)
downloadvyos-cloud-init-7deec7b6a1fce87dc2d9cd886053804bbc70380e.tar.gz
vyos-cloud-init-7deec7b6a1fce87dc2d9cd886053804bbc70380e.zip
OpenNebula: Update network to return v2 config rather than ENI.
OpenNebulaNetwork.gen_conf() was previously returning ENI format. This is updated to return netplan/v2 config. The changes here also adds support for IPv6 configuration distributed from OpenNebula and fixes some issues about nameserver information.
Diffstat (limited to 'cloudinit/net/network_state.py')
-rw-r--r--cloudinit/net/network_state.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/cloudinit/net/network_state.py b/cloudinit/net/network_state.py
index 1dd7ded7..6d63e5c5 100644
--- a/cloudinit/net/network_state.py
+++ b/cloudinit/net/network_state.py
@@ -708,6 +708,7 @@ class NetworkStateInterpreter(object):
gateway4 = None
gateway6 = None
+ nameservers = {}
for address in cfg.get('addresses', []):
subnet = {
'type': 'static',
@@ -723,6 +724,15 @@ class NetworkStateInterpreter(object):
gateway4 = cfg.get('gateway4')
subnet.update({'gateway': gateway4})
+ if 'nameservers' in cfg and not nameservers:
+ addresses = cfg.get('nameservers').get('addresses')
+ if addresses:
+ nameservers['dns_nameservers'] = addresses
+ search = cfg.get('nameservers').get('search')
+ if search:
+ nameservers['dns_search'] = search
+ subnet.update(nameservers)
+
subnets.append(subnet)
routes = []