cloud-init attempts to rename bonds
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
cloud-init |
Fix Released
|
Medium
|
Unassigned | ||
cloud-init (Ubuntu) |
Fix Released
|
Medium
|
Unassigned | ||
Xenial |
Fix Released
|
Medium
|
Unassigned | ||
Yakkety |
Fix Released
|
Medium
|
Unassigned |
Bug Description
=== Begin SRU Template ===
[Impact]
When booting with bonds provided in networking configuration, cloud-init
can fail as it attempts to rename the bond device to an interface.
[Test Case]
* download ubuntu cloud image
* mount image, enable proposed, update, upgrade cloud-init
* run 'bond-rename-
* login to kvm guest as 'ubuntu:passw0rd'
* sudo cloud-init init
the 'cloud-init init' above would fail before in an attempt
to rename a bond device. It will succeed now, as it will realize
that it does not have anything to do.
[Regression Potential]
Should be small. regressions would be certainly related to
bond or vlan configurations.
=== End SRU Template ===
1. Zesty amd64
2. cloud-init 0.7.9-47-
3. cloud-init boots with a bond network config and does not attempt to rename bond0
4. cloud-init init (net mode) fails when it attempts to rename a bond interface
Running with the following network config (2 nics)
config:
- mac_address: bc:76:4e:06:96:b3
name: interface0
type: physical
- mac_address: bc:76:4e:04:88:41
name: interface1
type: physical
- bond_interfaces:
- interface0
- interface1
name: bond0
params:
bond_mode: 802.3ad
type: bond
- name: bond0.108
subnets:
- address: 65.61.151.38
netmask: 255.255.255.252
routes:
- gateway: 65.61.151.37
type: static
- address: 2001:4800:
netmask: 'ffff:ffff:
routes:
- gateway: 2001:4800:
type: static
type: vlan
vlan_id: '108'
vlan_link: bond0
- name: bond0.208
subnets:
- address: 10.184.225.122
netmask: 255.255.255.252
routes:
- gateway: 10.184.225.121
- gateway: 10.184.225.121
type: static
type: vlan
vlan_id: '208'
vlan_link: bond0
- address: 72.3.128.240
type: nameserver
- address: 72.3.128.241
type: nameserver
During cloud-init init --local; the network configuration is rendered and brought up
bond0 is a virtual interface which uses the MAC from one of the slaves.
In cloud-init init (net) mode, we check if the interfaces are named properly;
When cloud-init collects the current_
each device listed in /sys/class/net; this includes *virtual* devices, like bonds/bridges
Then it looks up an interface name by MAC, however the bond and one of the interfaces
have the same value which results in cloud-init attempting to rename bond0
The solution is to not collect MACs of virtual interfaces for rename-purpose since
virtual devices do not ever get renamed; their name is defined by the config.
diff --git a/cloudinit/
index ea649cc..e2a50ad 100755
--- a/cloudinit/
+++ b/cloudinit/
@@ -14,6 +14,7 @@ from cloudinit import util
LOG = logging.
SYS_CLASS_NET = "/sys/class/net/"
+SYS_DEV_VIRT_NET = "/sys/devices/
DEFAULT_
@@ -205,7 +206,11 @@ def _get_current_
"""Collect information necessary for rename_
names = get_devicelist()
bymac = {}
+ virtual = os.listdir(
for n in names:
+ # do not attempt to rename virtual interfaces
+ if n in virtual:
+ continue
Log file of a failure:
http://
Related bugs:
* bug 1682871: cloud-init attempts to rename vlans / get_interfaces_
Related branches
- Server Team CI bot: Approve (continuous-integration)
- Ryan Harper: Approve
-
Diff: 212 lines (+135/-19)2 files modifiedcloudinit/net/__init__.py (+59/-19)
tests/unittests/test_net.py (+76/-0)
Changed in cloud-init (Ubuntu): | |
status: | New → Confirmed |
importance: | Undecided → Medium |
Changed in cloud-init: | |
status: | New → Confirmed |
importance: | Undecided → Medium |
Changed in cloud-init: | |
status: | Confirmed → Fix Committed |
Changed in cloud-init (Ubuntu Xenial): | |
status: | New → Confirmed |
Changed in cloud-init (Ubuntu Yakkety): | |
status: | New → Confirmed |
Changed in cloud-init (Ubuntu Xenial): | |
importance: | Undecided → Medium |
Changed in cloud-init (Ubuntu Yakkety): | |
importance: | Undecided → Medium |
description: | updated |
description: | updated |
The suggested fix doesn't work, as cloud-init may be expected to rename devices that are virtual. The example is insid an lxc container.
# ls /sys/devices/ virtual/ net/
eth0 lo