yahoo-eng-team team mailing list archive
-
yahoo-eng-team team
-
Mailing list archive
-
Message #88914
[Bug 1855945] Re: Network Config Version 2 Device Configuration ID used as interface name when set-name is not specified
This bug is believed to be fixed in cloud-init in version 22.2. If this
is still a problem for you, please make a comment and set the state back
to New
Thank you.
** Changed in: cloud-init
Status: Triaged => Fix Released
--
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to cloud-init.
https://bugs.launchpad.net/bugs/1855945
Title:
Network Config Version 2 Device Configuration ID used as interface
name when set-name is not specified
Status in cloud-init:
Fix Released
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-cluster-controlplane-0"
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://github.com/canonical/cloud-init/blob/ec6924ea1d321cc87e7414bee7734074590045b8/cloudinit/net/network_state.py#L645]
for eth, cfg in command.items():
phy_cmd = {
'type': 'physical',
'name': cfg.get('set-name', eth),
}
See debug output where set-name is not specified and the ethernet device config id = id0:
2019-12-05 01:50:14,692 - network_state.py[DEBUG]: v2(ethernets) -> v1(physical):
{'subnets': [{'dns_nameservers': ['10.10.10.10'], 'type': 'static', 'gateway': '10.7.7.254', 'address': '10.7.5.102/21'}], 'name': 'id0', 'mac_address': '00:50:56:a5:75:b3', 'type': 'physical', 'wakeonlan': True, 'match': {'macaddress': '00:50:56:a5:75:b3'}}
Within CentOS the sysconfig renderer then later uses this Device Config ID for the /etc/sysconfig/network-scripts/ifcfg- name and the DEVICE= parameter.
sysconfig.py code [https://github.com/canonical/cloud-
init/blob/ec6924ea1d321cc87e7414bee7734074590045b8/cloudinit/net/sysconfig.py#L701-L702]
cloud-init.log - without set-name configured:
2019-12-05 21:11:38,913 - stages.py[DEBUG]: Using distro class <class 'cloudinit.distros.photon.Distro'>
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 DataSourceVMwareGuestInfo not updated for events: System boot
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/setup-datasource: setting up datasource
2019-12-05 21:11:38,914 - DataSourceVMwareGuestInfo.py[INFO]: got host-info: {'network': {'interfaces': {'by-mac': OrderedDict([('00:50:56:a5:b2:b2', {'ipv6': [{'addr': 'fe80::250:56ff:fea5:b2b2%eth0', 'netmask': 'ffff:ffff:ffff:ffff::/64'}]})]), 'by-ipv4': OrderedDict(), 'by-ipv6': OrderedDict([('fe80::250:56ff:fea5:b2b2%eth0', {'netmask': 'ffff:ffff:ffff:ffff::/64', 'mac': '00:50:56:a5:b2:b2'})])}}, 'hostname': 'localhost', 'local-hostname': 'localhost'}
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:56:a5:b2:b2', 'eth0', 'vmxnet3', '0x07b0']]
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:56:a5:b2:b2'}, 'wakeonlan': True, 'set-name': 'eth0', 'dhcp4': False, 'dhcp6': False, 'addresses': ['10.7.5.101/21'], 'gateway4': '10.7.7.254', 'nameservers': {'addresses': ['10.10.10.10']}}}}
2019-12-05 21:57:19,199 - __init__.py[WARNING]: apply_network_config is not currently implemented for distribution '<class 'cloudinit.distros.photon.Distro'>'. Attempting to use apply_network
2019-12-05 21:57:19,199 - network_state.py[DEBUG]: v2(ethernets) -> v1(physical):
{'type': 'physical', 'name': 'eth0', 'mac_address': '00:50:56:a5:b2:b2', 'match': {'macaddress': '00:50:56:a5:b2:b2'}, 'wakeonlan': True, 'subnets': [{'type': 'static', 'address': '10.7.5.101/21', 'gateway': '10.7.7.254', 'dns_nameservers': ['10.10.10.10']}]}
2019-12-05 21:57:19,206 - network_state.py[DEBUG]: v2_common: handling config:
{'id0': {'match': {'macaddress': '00:50:56:a5:b2:b2'}, 'wakeonlan': True, 'set-name': 'eth0', 'dhcp4': False, 'dhcp6': False, 'addresses': ['10.7.5.101/21'], 'gateway4': '10.7.7.254', 'nameservers': {'addresses': ['10.10.10.10']}}}
2019-12-05 21:57:19,207 - photon.py[DEBUG]: Translated ubuntu style network settings # Converted from network_config for distro <class 'cloudinit.distros.photon.Distro'>
Implementation of _write_network_config is needed.
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/network/10-eth0.network - wb: [644] 77 bytes
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/desirable/nicer name than the default from udev’s ifnames.
Any additional device that satisfies the match rules will then fail to
get renamed and keep the original kernel name (and dmesg will show an
error).
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.
To manage notifications about this bug go to:
https://bugs.launchpad.net/cloud-init/+bug/1855945/+subscriptions
References