← Back to team overview

cloud-init-dev team mailing list archive

Re: [Merge] ~smoser/cloud-init:bug/1669860-no-rename-bonds into cloud-init:master

 

Generally speaking, get_interfaces_by_mac was simply broken for
any occurance of duplicate mac addresses.  From that perspective, this
is simply a fix.  The reality was that the "last" nic (per os.listdir())
would be the one chosen, which is not even sorted() (unless /sys was returning
a directory list that way).

I went ahead and added a RuntimeError on duplicate macs found.  That
makes this function safer.

As to whether or not all the callers are OK with this change,
the callers are:
 $ git grep -l get_interfaces_by_mac
 cloudinit/net/__init__.py
 cloudinit/sources/DataSourceOpenNebula.py
 cloudinit/sources/helpers/digitalocean.py
 cloudinit/sources/helpers/openstack.py
 tests/unittests/test_datasource/test_configdrive.py

cloudinit/net/__init__.py:
  this is just the definition and then the call that i just added.

cloudinit/sources/DataSourceOpenNebula.py:
 called from get_physical_nics_by_mac, which is pretty self
 explanatory, not expected to return bond or vlan.  it then filters
 the returned list by 'net.is_physical()' so that would filter out
 the bond or vlan anyway.


cloudinit/sources/helpers/digitalocean.py:
 called from convert_network_configuration which says:
   Convert the DigitalOcean Network description into Cloud-init's netconfig
   format.

 This method is just looking for macs in the network data from
 digital ocean to convert that to names.  Any vlan or bond here are
 going to break things.


cloudinit/sources/helpers/openstack.py
 called from 'convert_net_json' which is very similar to the digital ocean
 caller.  

-- 
https://code.launchpad.net/~smoser/cloud-init/+git/cloud-init/+merge/321578
Your team cloud init development team is requested to review the proposed merge of ~smoser/cloud-init:bug/1669860-no-rename-bonds into cloud-init:master.


References