I can reproduce this on Azure with advanced networking on 19.2
root@ragged-bond1:~# python3
Python 3.6.8 (default, Jan 14 2019, 11:02:34)
[GCC 8.0.1 20180414 (experimental) [trunk revision 259383]] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from cloudinit import net
>>> import yaml
>>> y = yaml.load(open('/etc/netplan/50-cloud-init.yaml'))
>>> net.wait_for_physdevs(y['network'])
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3/dist-packages/cloudinit/net/__init__.py", line 344, in wait_for_physdevs
present_macs = get_interfaces_by_mac().keys()
File "/usr/lib/python3/dist-packages/cloudinit/net/__init__.py", line 633, in get_interfaces_by_mac
(name, ret[mac], mac))
RuntimeError: duplicate mac found! both 'enP1s1' and 'eth0' have mac '00:0d:3a:6c:d9:80'
Looking at the sriov device, the sysfs attributes include a 'master' pointing to eth0, so I think we can reasonably ignore devices which have the 'master' which is related to device bonding.
+def has_master_attr(devname):
+ return os.path.exists(sys_dev_path(devname, path='master'))
+
+
def is_renamed(devname):
"""
/* interface name assignment types (sysfs name_assign_type attribute) */
@@ -661,6 +665,9 @@ continue
if is_bond(name): continue
+ if has_master_attr(name):
+ LOG.debug('Skipping device %s with "master" sysfs attriute', name)
+ continue
mac = get_interface_mac(name)
# some devices may not have a mac (tun0)
if not mac:
I can reproduce this on Azure with advanced networking on 19.2
root@ragged- bond1:~ # python3 open('/ etc/netplan/ 50-cloud- init.yaml' )) for_physdevs( y['network' ]) python3/ dist-packages/ cloudinit/ net/__init_ _.py", line 344, in wait_for_physdevs by_mac( ).keys( ) python3/ dist-packages/ cloudinit/ net/__init_ _.py", line 633, in get_interfaces_ by_mac
Python 3.6.8 (default, Jan 14 2019, 11:02:34)
[GCC 8.0.1 20180414 (experimental) [trunk revision 259383]] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from cloudinit import net
>>> import yaml
>>> y = yaml.load(
>>> net.wait_
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/
present_macs = get_interfaces_
File "/usr/lib/
(name, ret[mac], mac))
RuntimeError: duplicate mac found! both 'enP1s1' and 'eth0' have mac '00:0d:3a:6c:d9:80'
Looking at the sriov device, the sysfs attributes include a 'master' pointing to eth0, so I think we can reasonably ignore devices which have the 'master' which is related to device bonding.
root@ragged- bond1:/ usr/lib/ python3/ dist-packages# diff -u cloudinit/ net/__init_ _.py.orig cloudinit/ net/__init_ _.py net/__init_ _.py.orig 2019-09-16 21:15:42.550376776 +0000 net/__init_ _.py 2019-09-16 21:18:26.178760942 +0000 exists( sys_dev_ path(devname, "bonding"))
--- cloudinit/
+++ cloudinit/
@@ -109,6 +109,10 @@
return os.path.
+def has_master_ attr(devname) : exists( sys_dev_ path(devname, path='master')) devname) :
continue
continue attr(name) : mac(name)
+ return os.path.
+
+
def is_renamed(
"""
/* interface name assignment types (sysfs name_assign_type attribute) */
@@ -661,6 +665,9 @@
if is_bond(name):
+ if has_master_
+ LOG.debug('Skipping device %s with "master" sysfs attriute', name)
+ continue
mac = get_interface_
# some devices may not have a mac (tun0)
if not mac: