ConfigDrive: cloud-init fails to configure bond from network_data.json
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
cloud-init |
Fix Released
|
Medium
|
Unassigned | ||
cloud-init (Ubuntu) |
Fix Released
|
Medium
|
Unassigned | ||
Xenial |
Fix Released
|
Medium
|
Unassigned |
Bug Description
cloud-init fails to configure bond interfaces from network_data.json
There is a couple of reasons:
Bond links found in network_data.json do not have a name attribute. cloud-init doesn't require the name attribute to exist in links. [1] However cloud-init later expects the links to have a name attribute and crashes when it doesn't have any. [2] The name attribute is not part of the OpenStack network_data.json specification and will therefore never be provided.
If a link name is provided, the generated ENI configuration has a couple of issues:
1) cloud-init currently thinks that the bond_links attribute found in a bond link are actual physical interface names and not link id as expected.
This means you end up with 4 physical interfaces configured on the server: 2 existing physical interfaces (ex.: eno1 and eno2) and 2 physical interfaces based on the name found in bond_links (in that case, eth0 and eth1). The later don't exist on the server and configured bond interface tries to enslave non-existing links and fails to bring up.
2) The "auto" stanza is missing from bond and bond slave interfaces. Interfaces are never started/configured properly at boot.
3) Once 1) and 2) are fixed, it looks like cloud-init runs the network configuration again in dsmode=net and fails at multiple steps:
3.1) get_interfaces_
3.2) Once 3.1) is fixed, configuration fails again but for a different reason. It is because once the bonding is configured, all slave interfaces will have their mac addresses updated so they are all identical. This means convert_net_json will fail at the "need_names" step and will throw this exception: "No mac_address or name entry for" because now the mac address of one of the physical interface isn't found.
Here is attached to this bug a network_data.json for test purpose.
For reference, here is the MAC address mapping on the server:
- eno1: 0c:c4:7a:34:6e:3c
- eno2: 0c:c4:7a:34:6e:3d
Current rendered ENI is:
auto lo
iface lo inet loopback
iface eno1 inet manual
mtu 1500
iface eno2 inet manual
mtu 1500
iface bond0 inet manual
bond_miimon 100
bond_mode 4
bond-slaves none
auto eth0
iface eth0 inet manual
bond_miimon 100
bond-master bond0
bond_mode 4
auto eth1
iface eth1 inet manual
bond_miimon 100
bond-master bond0
bond_mode 4
auto bond0.602
iface bond0.602 inet static
netmask 255.255.255.248
address 2.2.2.13
hwaddress fa:16:3e:b3:72:30
vlan_id 602
post-up route add default gw 2.2.2.9 || true
pre-down route del default gw 2.2.2.9 || true
auto bond0.612
iface bond0.612 inet static
netmask 255.255.255.248
address 10.0.1.5
hwaddress fa:16:3e:66:ab:a6
vlan_id 612
post-up route add -net 192.168.1.0 netmask 255.255.255.255 gw 10.0.1.1 || true
pre-down route del -net 192.168.1.0 netmask 255.255.255.255 gw 10.0.1.1 || true
[1] http://
[2] http://
Related branches
- Mathieu Gagné (community): Approve
- Matthew Thode (community): Approve
- cloud-init Commiters: Pending requested
-
Diff: 249 lines (+156/-9)3 files modifiedcloudinit/net/eni.py (+1/-1)
cloudinit/sources/helpers/openstack.py (+50/-8)
tests/unittests/test_datasource/test_configdrive.py (+105/-0)
description: | updated |
Changed in cloud-init: | |
status: | New → Confirmed |
importance: | Undecided → Medium |
description: | updated |
Changed in cloud-init (Ubuntu): | |
status: | New → Fix Released |
Changed in cloud-init (Ubuntu Xenial): | |
status: | New → In Progress |
importance: | Undecided → Medium |
Changed in cloud-init (Ubuntu): | |
importance: | Undecided → Medium |
I pushed some code to /code.launchpad .net/~smoser/ cloud-init/ +git/cloud- init/+ref/ bond_name
https:/
that i think is working. the rendered ENI looks like:
auto lo
iface lo inet loopback
dns-nameservers 1.1.1.191 1.1.1.4
auto oeth0 xmit_hash_ policy layer3+4
iface oeth0 inet manual
bond-master bond0
bond_miimon 100
bond_mode 4
bond_
mtu 1500
auto oeth1 xmit_hash_ policy layer3+4
iface oeth1 inet manual
bond-master bond0
bond_miimon 100
bond_mode 4
bond_
mtu 1500
iface bond0 inet manual xmit_hash_ policy layer3+4
bond-slaves none
bond_miimon 100
bond_mode 4
bond_
auto bond0.602
iface bond0.602 inet static
address 2.2.2.13
netmask 255.255.255.248
hwaddress fa:16:3e:b3:72:30
vlan-raw-device bond0
vlan_id 602
post-up route add default gw 2.2.2.9 || true
pre-down route del default gw 2.2.2.9 || true
auto bond0.612
iface bond0.612 inet static
address 10.0.1.5
netmask 255.255.255.248
hwaddress fa:16:3e:66:ab:a6
vlan-raw-device bond0
vlan_id 612
post-up route add -net 192.168.1.0 netmask 255.255.255.255 gw 10.0.1.1 || true
pre-down route del -net 192.168.1.0 netmask 255.255.255.255 gw 10.0.1.1 || true