forked from pool/cloud-init
- Properly handle persistent network device names for OpenNebula (bnc#918952)
+ add dataSourceOpenNebula.patch - Properly set up network mode if interface config file (bnc#918952) + modified suseIntegratedHandler.patch OBS-URL: https://build.opensuse.org/package/show/Cloud:Tools/cloud-init?expand=0&rev=31
This commit is contained in:
parent
1096eb56d9
commit
ba2f40691d
@ -1,3 +1,11 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Tue Feb 24 15:52:13 UTC 2015 - rjschwei@suse.com
|
||||||
|
|
||||||
|
- Properly handle persistent network device names for OpenNebula (bnc#918952)
|
||||||
|
+ add dataSourceOpenNebula.patch
|
||||||
|
- Properly set up network mode if interface config file (bnc#918952)
|
||||||
|
+ modified suseIntegratedHandler.patch
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Thu Feb 5 10:16:54 UTC 2015 - tbechtold@suse.com
|
Thu Feb 5 10:16:54 UTC 2015 - tbechtold@suse.com
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# spec file for package cloud-init
|
# spec file for package cloud-init
|
||||||
#
|
#
|
||||||
# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
# Copyright (c) 2015 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
||||||
#
|
#
|
||||||
# All modifications and additions to the file contributed by third parties
|
# All modifications and additions to the file contributed by third parties
|
||||||
# remain the property of their copyright owners, unless otherwise agreed
|
# remain the property of their copyright owners, unless otherwise agreed
|
||||||
@ -40,6 +40,7 @@ Patch7: suseSetInitCmd.patch
|
|||||||
Patch8: cloudinit-datasources.patch
|
Patch8: cloudinit-datasources.patch
|
||||||
Patch9: cloud-init-no-dmidecode-on-ppc64.patch
|
Patch9: cloud-init-no-dmidecode-on-ppc64.patch
|
||||||
Patch10: cloud-init-no-user-lock-if-already-locked.patch
|
Patch10: cloud-init-no-user-lock-if-already-locked.patch
|
||||||
|
Patch11: dataSourceOpenNebula.patch
|
||||||
BuildRequires: fdupes
|
BuildRequires: fdupes
|
||||||
BuildRequires: filesystem
|
BuildRequires: filesystem
|
||||||
BuildRequires: python-devel
|
BuildRequires: python-devel
|
||||||
@ -133,6 +134,7 @@ Unit tests for the cloud-init tools
|
|||||||
%patch8 -p1
|
%patch8 -p1
|
||||||
%patch9 -p1
|
%patch9 -p1
|
||||||
%patch10 -p1
|
%patch10 -p1
|
||||||
|
%patch11 -p2
|
||||||
|
|
||||||
%if 0%{?suse_version} <= 1130
|
%if 0%{?suse_version} <= 1130
|
||||||
# disable ecdsa for SLE 11 (not available)
|
# disable ecdsa for SLE 11 (not available)
|
||||||
|
101
dataSourceOpenNebula.patch
Normal file
101
dataSourceOpenNebula.patch
Normal file
@ -0,0 +1,101 @@
|
|||||||
|
diff -Nurb suse/opensuse-13.2-orig/cloudinit/sources/DataSourceOpenNebula.py suse/opensuse-13.2-opennebula-patch/cloudinit/sources/DataSourceOpenNebula.py
|
||||||
|
--- suse/opensuse-13.2-orig/cloudinit/sources/DataSourceOpenNebula.py 2015-02-21 18:33:37.148247653 +0200
|
||||||
|
+++ suse/opensuse-13.2-opennebula-patch/cloudinit/sources/DataSourceOpenNebula.py 2015-02-21 19:45:29.535835879 +0200
|
||||||
|
@@ -149,7 +149,7 @@
|
||||||
|
|
||||||
|
class OpenNebulaNetwork(object):
|
||||||
|
REG_DEV_MAC = re.compile(
|
||||||
|
- r'^\d+: (eth\d+):.*?link\/ether (..:..:..:..:..:..) ?',
|
||||||
|
+ r'^\d+: (\w+):.*?link\/\w+ (..:..:..:..:..:..) ?',
|
||||||
|
re.MULTILINE | re.DOTALL)
|
||||||
|
|
||||||
|
def __init__(self, ip, context):
|
||||||
|
@@ -158,7 +158,11 @@
|
||||||
|
self.ifaces = self.get_ifaces()
|
||||||
|
|
||||||
|
def get_ifaces(self):
|
||||||
|
- return self.REG_DEV_MAC.findall(self.ip)
|
||||||
|
+ list = self.REG_DEV_MAC.findall(self.ip)
|
||||||
|
+ ifaces = dict()
|
||||||
|
+ for l in list:
|
||||||
|
+ ifaces[l[1]] = l[0]
|
||||||
|
+ return ifaces
|
||||||
|
|
||||||
|
def mac2ip(self, mac):
|
||||||
|
components = mac.split(':')[2:]
|
||||||
|
@@ -206,6 +210,15 @@
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
|
+ def get_context_interfaces(self):
|
||||||
|
+
|
||||||
|
+ def device_mac(t): return re.match(r"ETH\d+_MAC", t)
|
||||||
|
+
|
||||||
|
+ mac_vars = filter(device_mac, self.context.keys())
|
||||||
|
+
|
||||||
|
+ context_interfaces = [v.split('_')[0] for v in mac_vars]
|
||||||
|
+ return context_interfaces
|
||||||
|
+
|
||||||
|
def gen_conf(self):
|
||||||
|
global_dns = []
|
||||||
|
if 'DNS' in self.context:
|
||||||
|
@@ -216,27 +229,39 @@
|
||||||
|
conf.append('iface lo inet loopback')
|
||||||
|
conf.append('')
|
||||||
|
|
||||||
|
- for i in self.ifaces:
|
||||||
|
- dev = i[0]
|
||||||
|
- mac = i[1]
|
||||||
|
+ context_interfaces = self.get_context_interfaces()
|
||||||
|
+
|
||||||
|
+ if len(context_interfaces):
|
||||||
|
+ try:
|
||||||
|
+ (out, _err) = util.subp(["systemctl", "stop", "NetworkManager"])
|
||||||
|
+ (out, _err) = util.subp(["systemctl", "disable", "NetworkManager"])
|
||||||
|
+ except util.ProcessExecutionError:
|
||||||
|
+ util.logexc(LOG, "Disable NetworkManager command failed")
|
||||||
|
+
|
||||||
|
+ for interface in context_interfaces:
|
||||||
|
+ mac = self.context[interface+"_MAC"]
|
||||||
|
+ dev = self.ifaces.get(mac)
|
||||||
|
+ if dev is None:
|
||||||
|
+ continue
|
||||||
|
+
|
||||||
|
ip_components = self.mac2ip(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(interface, ip_components))
|
||||||
|
+ conf.append(' network ' + self.get_network(interface, ip_components))
|
||||||
|
+ conf.append(' netmask ' + self.get_mask(interface))
|
||||||
|
|
||||||
|
- gateway = self.get_gateway(dev)
|
||||||
|
+ gateway = self.get_gateway(interface)
|
||||||
|
if gateway:
|
||||||
|
conf.append(' gateway ' + gateway)
|
||||||
|
|
||||||
|
- domain = self.get_domain(dev)
|
||||||
|
+ domain = self.get_domain(interface)
|
||||||
|
if domain:
|
||||||
|
conf.append(' dns-search ' + domain)
|
||||||
|
|
||||||
|
# add global DNS servers to all interfaces
|
||||||
|
- dns = self.get_dns(dev)
|
||||||
|
+ dns = self.get_dns(interface)
|
||||||
|
if global_dns or dns:
|
||||||
|
all_dns = global_dns
|
||||||
|
if dns:
|
||||||
|
@@ -404,8 +429,8 @@
|
||||||
|
|
||||||
|
if ssh_key_var:
|
||||||
|
lines = context.get(ssh_key_var).splitlines()
|
||||||
|
- results['metadata']['public-keys'] = [l for l in lines
|
||||||
|
- if len(l) and not l.startswith("#")]
|
||||||
|
+ ssh_keys = [l for l in lines if len(l) and not l.startswith("#")]
|
||||||
|
+ results['metadata']['public-keys'] = ssh_keys
|
||||||
|
|
||||||
|
# custom hostname -- try hostname or leave cloud-init
|
||||||
|
# itself create hostname from IP address later
|
@ -1,6 +1,6 @@
|
|||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ cloudinit/distros/opensuse.py
|
+++ cloudinit/distros/opensuse.py
|
||||||
@@ -0,0 +1,210 @@
|
@@ -0,0 +1,209 @@
|
||||||
+# vi: ts=4 expandtab
|
+# vi: ts=4 expandtab
|
||||||
+#
|
+#
|
||||||
+# Copyright (C) 2014 SUSE LLC
|
+# Copyright (C) 2014 SUSE LLC
|
||||||
@ -176,8 +176,8 @@
|
|||||||
+ dev_names = entries.keys()
|
+ dev_names = entries.keys()
|
||||||
+ for (dev, info) in entries.iteritems():
|
+ for (dev, info) in entries.iteritems():
|
||||||
+ net_fn = self.network_script_tpl % (dev)
|
+ net_fn = self.network_script_tpl % (dev)
|
||||||
+ mode = info.get('auto')
|
+ mode = None
|
||||||
+ if mode and mode.lower() == 'true':
|
+ if info.get('auto', None):
|
||||||
+ mode = 'auto'
|
+ mode = 'auto'
|
||||||
+ else:
|
+ else:
|
||||||
+ mode = 'manual'
|
+ mode = 'manual'
|
||||||
@ -192,7 +192,6 @@
|
|||||||
+ 'USERCONTROL': 'no'
|
+ 'USERCONTROL': 'no'
|
||||||
+ }
|
+ }
|
||||||
+ if dev != 'lo':
|
+ if dev != 'lo':
|
||||||
+ net_cfg['ETHERDEVICE'] = dev
|
|
||||||
+ net_cfg['ETHTOOL_OPTIONS'] = ''
|
+ net_cfg['ETHTOOL_OPTIONS'] = ''
|
||||||
+ else:
|
+ else:
|
||||||
+ net_cfg['FIREWALL'] = 'no'
|
+ net_cfg['FIREWALL'] = 'no'
|
||||||
|
Loading…
Reference in New Issue
Block a user