diff options
author | Ryan Harper <ryan.harper@canonical.com> | 2017-06-20 17:06:43 -0500 |
---|---|---|
committer | Scott Moser <smoser@brickies.net> | 2017-06-27 17:03:34 -0400 |
commit | ebc9ecbc8a76bdf511a456fb72339a7eb4c20568 (patch) | |
tree | 3b735b43bde5c5d8e96e602f5a7a6c39dd20f34c /cloudinit/net/udev.py | |
parent | 10e5195e4a4459d1893801aa9fb486dc2973415d (diff) | |
download | vyos-cloud-init-ebc9ecbc8a76bdf511a456fb72339a7eb4c20568.tar.gz vyos-cloud-init-ebc9ecbc8a76bdf511a456fb72339a7eb4c20568.zip |
Azure: Add network-config, Refactor net layer to handle duplicate macs.
On systems with network devices with duplicate mac addresses, cloud-init
will fail to rename the devices according to the specified network
configuration. Refactor net layer to search by device driver and device
id if available. Azure systems may have duplicate mac addresses by
design.
Update Azure datasource to run at init-local time and let Azure datasource
generate a fallback networking config to handle advanced networking
configurations.
Lastly, add a 'setup' method to the datasources that is called before
userdata/vendordata is processed but after networking is up. That is
used here on Azure to interact with the 'fabric'.
Diffstat (limited to 'cloudinit/net/udev.py')
-rw-r--r-- | cloudinit/net/udev.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/cloudinit/net/udev.py b/cloudinit/net/udev.py index fd2fd8c7..58c0a708 100644 --- a/cloudinit/net/udev.py +++ b/cloudinit/net/udev.py @@ -23,7 +23,7 @@ def compose_udev_setting(key, value): return '%s="%s"' % (key, value) -def generate_udev_rule(interface, mac): +def generate_udev_rule(interface, mac, driver=None): """Return a udev rule to set the name of network interface with `mac`. The rule ends up as a single line looking something like: @@ -31,10 +31,13 @@ def generate_udev_rule(interface, mac): SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}="ff:ee:dd:cc:bb:aa", NAME="eth0" """ + if not driver: + driver = '?*' + rule = ', '.join([ compose_udev_equality('SUBSYSTEM', 'net'), compose_udev_equality('ACTION', 'add'), - compose_udev_equality('DRIVERS', '?*'), + compose_udev_equality('DRIVERS', driver), compose_udev_attr_equality('address', mac), compose_udev_setting('NAME', interface), ]) |