Merge ~smoser/cloud-init:bug/1669860-no-rename-bonds into cloud-init:master
| Status: | Merged | ||||
|---|---|---|---|---|---|
| Merged at revision: | bf7723e8092bb1f8a442aa2399dd870e130a27d9 | ||||
| Proposed branch: | ~smoser/cloud-init:bug/1669860-no-rename-bonds | ||||
| Merge into: | cloud-init:master | ||||
| Diff against target: |
212 lines (+135/-19) 2 files modified
cloudinit/net/__init__.py (+59/-19) tests/unittests/test_net.py (+76/-0) |
||||
| Related bugs: |
|
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Server Team CI bot | continuous-integration | Approve on 2017-03-31 | |
| Ryan Harper | 2017-03-31 | Approve on 2017-03-31 | |
|
Review via email:
|
|||
Commit Message
Fix bug that resulted in an attempt to rename bonds or vlans.
When cloud-init ran in the init stage (after networking had come up).
A bug could occur where cloud-init would attempt and fail to rename
network devices that had "inherited" mac addresses.
The intent of apply_network_
the devices that were "physical" per the network config. (This would
include veth devices in a container). The bug was in creating
the dictionary of interfaces by mac address. If there were multiple
interfaces with the same mac address then renames could fail.
This situation was guaranteed to occur with bonds or vlans or other
devices that inherit their mac.
The solution is to change get_interfaces_
that have an inherited mac.
LP: #1669860
| Scott Moser (smoser) wrote : | # |
Generally speaking, get_interfaces_
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_
cloudinit/
cloudinit/
cloudinit/
cloudinit/
tests/
cloudinit/
this is just the definition and then the call that i just added.
cloudinit/
called from get_physical_
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/
called from convert_
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/
called from 'convert_net_json' which is very similar to the digital ocean
caller.
FAILED: Continuous integration, rev:895e007a51d
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
FAILURE: https:/
FAILURE: https:/
SUCCESS: https:/
Click here to trigger a rebuild:
https:/
FAILED: Continuous integration, rev:c2e308ad4ec
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
FAILURE: https:/
SUCCESS: https:/
Click here to trigger a rebuild:
https:/
| Ryan Harper (raharper) wrote : | # |
Approved with the addition of a unittest, ideally a check that we don't attempt to rename a bond/bridge device.
PASSED: Continuous integration, rev:82c81d6ed39
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
Click here to trigger a rebuild:
https:/
| Scott Moser (smoser) wrote : | # |
> Approved with the addition of a unittest, ideally a check that we don't
> attempt to rename a bond/bridge device.
I'll add a few unit tests for get_interfaces_
PASSED: Continuous integration, rev:ac99bfb76ec
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
Click here to trigger a rebuild:
https:/
PASSED: Continuous integration, rev:bf7723e8092
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
Click here to trigger a rebuild:
https:/


PASSED: Continuous integration, rev:78e4aae8ae7 2b9173e1aa578a7 bcd5d3ac581cb9 /jenkins. ubuntu. com/server/ job/cloud- init-ci/ 194/ /jenkins. ubuntu. com/server/ job/cloud- init-ci/ nodes=metal- amd64/194 /jenkins. ubuntu. com/server/ job/cloud- init-ci/ nodes=metal- arm64/194 /jenkins. ubuntu. com/server/ job/cloud- init-ci/ nodes=metal- ppc64el/ 194 /jenkins. ubuntu. com/server/ job/cloud- init-ci/ nodes=metal- s390x/194 /jenkins. ubuntu. com/server/ job/cloud- init-ci/ nodes=vm- i386/194
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
Click here to trigger a rebuild: /jenkins. ubuntu. com/server/ job/cloud- init-ci/ 194/rebuild
https:/