cloud-init-dev team mailing list archive
-
cloud-init-dev team
-
Mailing list archive
-
Message #03315
[Merge] ~enolfc/cloud-init:bug-1716397 into cloud-init:master
Enol Fernández has proposed merging ~enolfc/cloud-init:bug-1716397 into cloud-init:master.
Requested reviews:
cloud-init commiters (cloud-init-dev)
For more details, see:
https://code.launchpad.net/~enolfc/cloud-init/+git/cloud-init/+merge/330518
Fixes bug #1716397
--
Your team cloud-init commiters is requested to review the proposed merge of ~enolfc/cloud-init:bug-1716397 into cloud-init:master.
diff --git a/cloudinit/sources/DataSourceOpenNebula.py b/cloudinit/sources/DataSourceOpenNebula.py
index 5fdac19..b6feb98 100644
--- a/cloudinit/sources/DataSourceOpenNebula.py
+++ b/cloudinit/sources/DataSourceOpenNebula.py
@@ -19,6 +19,7 @@ import string
from cloudinit import log as logging
from cloudinit import net
+from cloudinit.net import eni
from cloudinit import sources
from cloudinit import util
@@ -86,7 +87,7 @@ class DataSourceOpenNebula(sources.DataSource):
return False
self.seed = seed
- self.network_eni = results.get("network_config")
+ self.network_eni = results.get("network-interfaces")
self.metadata = md
self.userdata_raw = results.get('userdata')
return True
@@ -99,6 +100,12 @@ class DataSourceOpenNebula(sources.DataSource):
resolve_ip = False
return sources.DataSource.get_hostname(self, fqdn, resolve_ip)
+ @property
+ def network_config(self):
+ if self.network_eni:
+ return eni.convert_eni_data(self.network_eni)
+ return None
+
class NonContextDiskDir(Exception):
pass
@@ -161,6 +168,13 @@ class OpenNebulaNetwork(object):
else:
return None
+ def mac2dev(self, mac):
+ for k in self.context:
+ m = re.match(r'(ETH\d+)_MAC$', k)
+ if self.context[k] == mac:
+ return m.groups()[0]
+
+
def gen_conf(self):
global_dns = []
if 'DNS' in self.context:
@@ -174,22 +188,24 @@ class OpenNebulaNetwork(object):
for mac, dev in self.ifaces.items():
ip_components = self.mac2ip(mac)
+ one_dev = self.mac2dev(mac)
+
conf.append('auto ' + dev)
conf.append('iface ' + dev + ' inet static')
- conf.append(' address ' + self.get_ip(dev, ip_components))
- conf.append(' network ' + self.get_network(dev, ip_components))
- conf.append(' netmask ' + self.get_mask(dev))
+ conf.append(' address ' + self.get_ip(one_dev, ip_components))
+ conf.append(' network ' + self.get_network(one_dev, ip_components))
+ conf.append(' netmask ' + self.get_mask(one_dev))
- gateway = self.get_gateway(dev)
+ gateway = self.get_gateway(one_dev)
if gateway:
conf.append(' gateway ' + gateway)
- domain = self.get_domain(dev)
+ domain = self.get_domain(one_dev)
if domain:
conf.append(' dns-search ' + domain)
# add global DNS servers to all interfaces
- dns = self.get_dns(dev)
+ dns = self.get_dns(one_dev)
if global_dns or dns:
all_dns = global_dns
if dns:
Follow ups
-
[Merge] ~enolfc/cloud-init:bug-1716397 into cloud-init:master
From: Scott Moser, 2017-11-01
-
Re: [Merge] ~enolfc/cloud-init:bug-1716397 into cloud-init:master
From: Scott Moser, 2017-11-01
-
Re: [Merge] ~enolfc/cloud-init:bug-1716397 into cloud-init:master
From: Scott Moser, 2017-09-21
-
Re: [Merge] ~enolfc/cloud-init:bug-1716397 into cloud-init:master
From: Server Team CI bot, 2017-09-18
-
Re: [Merge] ~enolfc/cloud-init:bug-1716397 into cloud-init:master
From: Server Team CI bot, 2017-09-13
-
Re: [Merge] ~enolfc/cloud-init:bug-1716397 into cloud-init:master
From: Scott Moser, 2017-09-12
-
Re: [Merge] ~enolfc/cloud-init:bug-1716397 into cloud-init:master
From: Scott Moser, 2017-09-11
-
Re: [Merge] ~enolfc/cloud-init:bug-1716397 into cloud-init:master
From: Scott Moser, 2017-09-11
-
[Merge] ~enolfc/cloud-init:bug-1716397 into cloud-init:master
From: Scott Moser, 2017-09-11
-
Re: [Merge] ~enolfc/cloud-init:bug-1716397 into cloud-init:master
From: Enol Fernández, 2017-09-11
-
[Merge] ~enolfc/cloud-init:bug-1716397 into cloud-init:master
From: Enol Fernández, 2017-09-11