Network Config Version 2 Device Configuration ID used as interface name when set-name is not specified
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
cloud-init |
Fix Released
|
Low
|
Unassigned |
Bug Description
With Cloud-Init Network Config Version 2, the name of Device Configuration ID object is overwriting the ethernet interface device name when set-name is not specified.
Example - Version 2 metadata:
instance-id: "management-
network:
version: 2
ethernets:
id0:
match:
macaddress: "00:50:56:a5:1a:78"
When 'set-name' is not defined within the version 2 config, then cloud-init network_state.py retrieves the name of the ethernet dict. In the above case it would be "id0":
network_state.py code [https:/
for eth, cfg in command.items():
phy_cmd = {
}
See debug output where set-name is not specified and the ethernet device config id = id0:
2019-12-05 01:50:14,692 - network_
{'subnets': [{'dns_
Within CentOS the sysconfig renderer then later uses this Device Config ID for the /etc/sysconfig/
sysconfig.py code [https:/
cloud-init.log - without set-name configured:
2019-12-05 21:11:38,913 - stages.py[DEBUG]: Using distro class <class 'cloudinit.
2019-12-05 21:11:38,914 - __init__.py[DEBUG]: no interfaces to rename
2019-12-05 21:11:38,914 - __init__.py[DEBUG]: Datasource DataSourceVMwar
2019-12-05 21:11:38,914 - stages.py[DEBUG]: No network config applied. Neither a new instance nor datasource network update on 'System boot' event
2019-12-05 21:11:38,914 - handlers.py[DEBUG]: start: init-network/
2019-12-05 21:11:38,914 - DataSourceVMwar
cloud-init.log - with set-name: eth0 configured:
2019-12-05 21:57:19,179 - util.py[DEBUG]: Running command ['ip', '-6', 'addr', 'show', 'permanent', 'scope', 'global'] with allowed return codes [0] (shell=False, capture=True)
2019-12-05 21:57:19,190 - util.py[DEBUG]: Running command ['ip', '-4', 'addr', 'show'] with allowed return codes [0] (shell=False, capture=True)
2019-12-05 21:57:19,198 - __init__.py[DEBUG]: no work necessary for renaming of [['00:50:
2019-12-05 21:57:19,198 - stages.py[INFO]: Applying network configuration from system_cfg bringup=False: {'version': 2, 'ethernets': {'id0': {'match': {'macaddress': '00:50:
2019-12-05 21:57:19,199 - __init_
2019-12-05 21:57:19,199 - network_
{'type': 'physical', 'name': 'eth0', 'mac_address': '00:50:
2019-12-05 21:57:19,206 - network_
{'id0': {'match': {'macaddress': '00:50:
2019-12-05 21:57:19,207 - photon.py[DEBUG]: Translated ubuntu style network settings # Converted from network_config for distro <class 'cloudinit.
Implementation of _write_
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
hwaddress 00:50:56:a5:b2:b2
address 10.7.5.101/21
dns-nameservers 10.10.10.10
gateway 10.7.7.254
into {'lo': {'ipv6': {}, 'auto': True}, 'eth0': {'ipv6': {}, 'bootproto': 'static', 'address': '10.7.5.101', 'gateway': '10.7.7.254', 'netmask': '255.255.248.0', 'broadcast': '10.7.7.255', 'dns-nameservers': ['10.10.10.10'], 'auto': True}}
2019-12-05 21:57:19,208 - util.py[DEBUG]: Writing to /etc/systemd/
From the documentation it seems that using set-name is optional:
When matching on unique properties such as path or MAC, or with additional assumptions such as “there will only ever be one wifi device”, match rules can be written so that they only match one device. Then this property can be used to give that device a more specific/
One would expect if set-name is not used the default Persistent Network Device Name would be used for the network configuration file name and the interface device name.
Changed in cloud-init: | |
importance: | Undecided → Low |
status: | New → Triaged |
This should be fixed with:
- https:/ /github. com/canonical/ cloud-init/ pull/1336 /github. com/canonical/ cloud-init/ pull/1327
- https:/