Garrett Holmstrom 2017-04-14 15:00:45 -07:00
parent 78a0f3861c
commit 8939822a56
2 changed files with 56 additions and 0 deletions

View File

@ -0,0 +1,50 @@
Index: cloud-init-0.7.9/cloudinit/sources/helpers/digitalocean.py
===================================================================
--- cloud-init-0.7.9.orig/cloudinit/sources/helpers/digitalocean.py
+++ cloud-init-0.7.9/cloudinit/sources/helpers/digitalocean.py
@@ -121,27 +121,31 @@ def convert_network_configuration(config
return subpart
- all_nics = []
- for k in ('public', 'private'):
- if k in config:
- all_nics.extend(config[k])
-
- macs_to_nics = cloudnet.get_interfaces_by_mac()
nic_configs = []
+ macs_to_nics = cloudnet.get_interfaces_by_mac()
+ LOG.debug("nic mapping: %s", macs_to_nics)
- for nic in all_nics:
+ for n in config:
+ nic = config[n][0]
+ LOG.debug("considering %s", nic)
mac_address = nic.get('mac')
+ if mac_address not in macs_to_nics:
+ raise RuntimeError("Did not find network interface on system "
+ "with mac '%s'. Cannot apply configuration: %s"
+ % (mac_address, nic))
+
sysfs_name = macs_to_nics.get(mac_address)
nic_type = nic.get('type', 'unknown')
- # Note: the entry 'public' above contains a list, but
- # the list will only ever have one nic inside it per digital ocean.
- # If it ever had more than one nic, then this code would
- # assign all 'public' the same name.
- if_name = NIC_MAP.get(nic_type, sysfs_name)
- LOG.debug("mapped %s interface to %s, assigning name of %s",
- mac_address, sysfs_name, if_name)
+ if_name = NIC_MAP.get(nic_type, sysfs_name)
+ if if_name != sysfs_name:
+ LOG.debug("Found %s interface '%s' on '%s', assigned name of '%s'",
+ nic_type, mac_address, sysfs_name, if_name)
+ else:
+ msg = ("Found interface '%s' on '%s', which is not a public "
+ "or private interface. Using default system naming.")
+ LOG.debug(msg, mac_address, sysfs_name)
ncfg = {'type': 'physical',
'mac_address': mac_address,

View File

@ -85,6 +85,11 @@ Patch19: cloud-init-0.7.9-credcache.patch
# https://git.launchpad.net/cloud-init/commit/?id=493f6c3e923902d5d4f3d87e1cc4c726ea90ada4
Patch20: cloud-init-0.7.9-digitalocean-loopback.patch
# Configure all NICs presented in DigitalOcean metadata
# https://bugzilla.redhat.com/show_bug.cgi?id=1442463
# https://git.launchpad.net/cloud-init/commit/?id=ff44056771416cb811879b13b97f88d8f2057071
Patch21: quilt_patches/cloud-init-0.7.9-digitalocean-all-nics.patch
BuildArch: noarch
BuildRequires: pkgconfig(systemd)
@ -219,6 +224,7 @@ nosetests-%{python3_version} tests/unittests/
%changelog
* Fri Apr 14 2017 Garrett Holmstrom <gholms@fedoraproject.org> - 0.7.9-5
- Made DigitalOcean DNS server handling consistent with OpenStack [RH:1442463, LP:1675571]
- Improved handling of multiple NICs on DigitalOcean [RH:1442463]
* Tue Mar 14 2017 Garrett Holmstrom <gholms@fedoraproject.org> - 0.7.9-4
- Fixed systemd dependency cycle with cloud-final and os-collect-config [RH:1420946, RH:1428492]