cloud-init interface renaming should apply .lower() to mac_address values to match sysfs entries
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
cloud-init |
Fix Released
|
Medium
|
Unassigned | ||
cloud-init (Ubuntu) |
Fix Released
|
Medium
|
Unassigned | ||
Xenial |
Fix Released
|
Medium
|
Unassigned | ||
Zesty |
Fix Released
|
Medium
|
Unassigned |
Bug Description
=== Begin SRU Template ===
[Impact]
cloud-init takes network configuration input in a variety of formats.
It then applies that network configuration, including renaming devices
based on their mac address and provided name.
If the mac address provided contained upper case letters (hex values,
so A-F) then cloud-init would fail to rename the devices and show a
WARN message in /var/log/
The warn message would look like:
Failed to rename devices: [nic not present] Cannot rename
mac=
[Test Case]
The basic idea below is:
a.) launch an lxd instance with proposed version of cloud-init.
b.) inside instance, change the provided network config to use upper case
for mac addresses.
c.) clean the system and reboot.
d.) check no errors in /var/log/
## launch an instance.
$ release=xenial
$ ref=$release-
$ lxc-proposed-
$ lxc launch $ref $name
$ lxc exec $name -- /bin/bash
## inside
% read lower < /sys/class/
% echo $lower
00:16:3e:fc:3d:65
% upper=$(echo "$lower" | tr '[a-z]' '[A-Z]')
% sed -i.dist -e 's,\( *\)name: eth0,\1name: nic0\n\
/var/
% ( cd /var/lib/
--- network-config.dist 2017-08-01 20:44:48.445568094 +0000
+++ network-config 2017-08-01 20:44:58.277456919 +0000
@@ -1,7 +1,8 @@
version: 1
config:
- type: physical
- name: eth0
+ name: nic0
+ mac_address: "00:16:3E:5D:72:AE"
subnets:
- type: dhcp
## clean up skipping the 'seed' directory.
% ( cd /var/lib/cloud && for i in *; do [ "$i" = "seed" ] || rm -Rf $i; done )
% rm -Rf /var/log/
% reboot
## back outside, wait a bit, then
% lxc exec $name -- /bin/bash
% grep WARN /var/log/
% ip addr show nic0
90: nic0@if91: <BROADCAST,
link/ether 00:16:3e:5d:72:ae brd ff:ff:ff:ff:ff:ff link-netnsid 0
inet 10.75.205.253/24 brd 10.75.205.255 scope global nic0
valid_lft forever preferred_lft forever
inet6 fe80::216:
valid_lft forever preferred_lft forever
[Regression Potential]
Regression potential here should be very low. The fix was essentially to
be more liberal on matching mac addresses by using '.lower()' on both values.
[Other Info]
Upstream commit at
https:/
lxc-proposed-
https:/
It publishes an image to lxd with proposed enabled and cloud-init upgraded.
=== End SRU Template ===
When supplying a network config to cloud-init with MAC address values using Upper case letters, this will fail to match MAC address values returned from sysfs. THe result is that cloud-init gives up on the renaming of the interface.
Related branches
- Ryan Harper: Approve
- Server Team CI bot: Approve (continuous-integration)
-
Diff: 77 lines (+33/-2)2 files modifiedcloudinit/net/__init__.py (+6/-2)
tests/unittests/test_net.py (+27/-0)
Changed in cloud-init: | |
status: | New → Confirmed |
importance: | Undecided → Medium |
Changed in cloud-init: | |
status: | Confirmed → Fix Committed |
Changed in cloud-init (Ubuntu): | |
status: | New → Fix Released |
importance: | Undecided → Medium |
Changed in cloud-init (Ubuntu Xenial): | |
status: | New → Confirmed |
Changed in cloud-init (Ubuntu Zesty): | |
status: | New → Confirmed |
Changed in cloud-init (Ubuntu Xenial): | |
importance: | Undecided → Medium |
Changed in cloud-init (Ubuntu Zesty): | |
importance: | Undecided → Medium |
description: | updated |
Hello Ryan, or anyone else affected,
Accepted cloud-init into xenial-proposed. The package will build now and be available at https:/ /launchpad. net/ubuntu/ +source/ cloud-init/ 0.7.9-233- ge586fe35- 0ubuntu1~ 16.04.1 in a few hours, and then in the -proposed repository.
Please help us by testing this new package. See https:/ /wiki.ubuntu. com/Testing/ EnableProposed for documentation on how to enable and use -proposed.Your feedback will aid us getting this update out to other Ubuntu users.
If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested and change the tag from verification- needed- xenial to verification- done-xenial. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification- failed- xenial. In either case, details of your testing will help us make a better decision.
Further information regarding the verification process can be found at https:/ /wiki.ubuntu. com/QATeam/ PerformingSRUVe rification . Thank you in advance!