Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NoCloud - network_config bridges with set-name not configured by NM renderer #5717

Closed
xiachen-rh opened this issue Sep 19, 2024 · 0 comments
Closed
Assignees
Labels
bug Something isn't working correctly

Comments

@xiachen-rh
Copy link
Contributor

xiachen-rh commented Sep 19, 2024

Bug report

Creating two bridges on top of two interfaces using Network-Config version 2 for cloud-init, using NetworkManager renderer, cloud-init failed stage init-local with KeyError.
https://issues.redhat.com/browse/RHEL-52718

Environment details

  • Cloud-init version: cloud-init-23.4
  • Operating System Distribution: rhel 9.4
  • Cloud provider, platform or installer type: KVM, NoCloud

How reproducible:
100%

##Steps to reproduce the problem
I used the same Network-Config data with #5574 but using NM renderer.
modified /etc/cloud/cloud.cfg to
  network:
    renderers: ['network-manager', 'eni', 'netplan', 'sysconfig', 'networkd']

network-config

 network:
  bridges:
    baremetal:
      addresses:
      - fc00:1:1::2/64
      interfaces:
      - baremetalport
      nameservers:
        addresses:
        - fc00:1:1::1
      routes:
      - on-link: true
        to: ::/0
        via: fc00:1:1::1
      stp: false
    provisioning:
      addresses:
      - fc00:1:2::2/64
      interfaces:
      - provisioningport
      routes: []
      stp: false
  ethernets:
    baremetalport:
      match:
        macaddress: 52:54:00:bd:8f:cb
      set-name: baremetal0
    provisioningport:
      match:
        macaddress: 52:54:00:25:ae:12
      set-name: provisioning0
  renderer: NetworkManager
  version: 2

Command used to build config-drive ISO image:
genisoimage -output config-drive.iso -volid CIDATA -joliet
-rock user-data meta-data
network-config

Create a VM in libvirt with two network interfaces, match MAC address of network-config.
Boot the VM

Expected results
The VM should boot and correctly configure the network interfaces and bridges.

Actual results
cloud-init failed stage init-local with KeyError.

cloud-init logs

2024-08-03 07:43:52,820 - network_state.py[DEBUG]: v2(ethernets) -> v1(physical))
:
{'type': 'physical', 'mac_address': '52:54:00:25:ae:12', 'name': 'provisioning0''
, 'match': {'macaddress': '52:54:00:25:ae:12'}}
2024-08-03 07:43:52,826 - network_state.py[DEBUG]: v2_common: handling config:
{'baremetalport': {'match': {'macaddress': '52:54:00:bd:8f:cb'}, 'set-name': 'baremetal0'}, 'provisionport': {'match': {'macaddress': '52:54:00:25:ae:12'}, 'set-name': 'provisioning0'}}
2024-08-03 07:43:52,828 - network_manager.py[WARNING]: iface: {'name': 'baremetalport', 'type': None, 'mac_address': None, 'inet': 'inet', 'mode': 'manual', 'mtu': None, 'address': None, 'gateway': None, 'subnets': [], 'accept-ra': None, 'wakeonlan': None}  type: None
2024-08-03 07:43:52,828 - network_manager.py[WARNING]: KeyError: None
2024-08-03 07:43:52,828 - util.py[WARNING]: failed stage init-local
2024-08-03 07:43:52,828 - util.py[DEBUG]: failed stage init-local
Traceback (most recent call last):
  File "/usr/lib/python3.9/site-packages/cloudinit/cmd/main.py", line 781, in status_wrapper
    ret = functor(name, args)
  File "/usr/lib/python3.9/site-packages/cloudinit/cmd/main.py", line 442, in main_init
    init.apply_network_config(bring_up=bring_up_interfaces)
  File "/usr/lib/python3.9/site-packages/cloudinit/stages.py", line 1061, in apply_network_config
    return self.distro.apply_network_config(
  File "/usr/lib/python3.9/site-packages/cloudinit/distros/__init__.py", line 413, in apply_network_config
    self._write_network_state(network_state, renderer)
  File "/usr/lib/python3.9/site-packages/cloudinit/distros/__init__.py", line 293, in _write_network_state
 478, in render_network_state
    conn.render_interface(iface, network_state, self)
  File "/usr/lib/python3.9/site-packages/cloudinit/net/network_manager.py", line 270, in render_interface
    raise err
  File "/usr/lib/python3.9/site-packages/cloudinit/net/network_manager.py", line 267, in render_interface
    if_type = _type_map[iface["type"]]
 KeyError: None

when I tested #5674, I found the error changed to

 2024-09-19 09:25:13,614 - network_state.py[DEBUG]: v2(ethernets) -> v1(physical))
:
{'config_id': 'provisionport', 'type': 'physical', 'mac_address': '52:54:00:25:ae:12', 'name': 'provisioning0', 'match': {'macaddress': '52:54:00:25:ae:12'}}
2024-09-19 09:25:13,620 - network_state.py[DEBUG]: v2_common: handling config:
{'baremetalport': {'match': {'macaddress': '52:54:00:bd:8f:cb'}, 'set-name': 'baremetal0'}, 'provisionport': {'match': {'macaddress': '52:54:00:25:ae:12'}, 'set-name': 'provisioning0'}}
2024-09-19 09:25:13,621 - util.py[WARNING]: failed stage init-local
2024-09-19 09:25:13,623 - util.py[DEBUG]: failed stage init-local
Traceback (most recent call last):
  File "/usr/lib/python3.9/site-packages/cloudinit/cmd/main.py", line 781, in status_wrapper
    ret = functor(name, args)
  File "/usr/lib/python3.9/site-packages/cloudinit/cmd/main.py", line 442, in main_init
    init.apply_network_config(bring_up=bring_up_interfaces)
  File "/usr/lib/python3.9/site-packages/cloudinit/stages.py", line 1061, in apply_network_config
    return self.distro.apply_network_config(
  File "/usr/lib/python3.9/site-packages/cloudinit/distros/__init__.py", line 413, in apply_network_config
    self._write_network_state(network_state, renderer)
  File "/usr/lib/python3.9/site-packages/cloudinit/distros/__init__.py", line 293, in _write_network_state
    renderer.render_network_state(network_state)
  File "/usr/lib/python3.9/site-packages/cloudinit/net/network_manager.py", line 472, in render_network_state
    conn.render_interface(iface, network_state, self)
  File "/usr/lib/python3.9/site-packages/cloudinit/net/network_manager.py", line 408, in render_interface
    port = renderer.get_conn(port)
  File "/usr/lib/python3.9/site-packages/cloudinit/net/network_manager.py", line 448, in get_conn
    return self.connections[con_id]
KeyError: 'baremetalport'
@xiachen-rh xiachen-rh added bug Something isn't working correctly new An issue that still needs triage labels Sep 19, 2024
@xiachen-rh xiachen-rh changed the title NoCloud - network_config bridges incorrectly configured by NM renderer NoCloud - network_config bridges with set-name not configured by NM renderer Sep 19, 2024
@a-dubs a-dubs removed the new An issue that still needs triage label Sep 23, 2024
TheRealFalcon added a commit to TheRealFalcon/cloud-init that referenced this issue Sep 24, 2024
Similar to the recent sysconfig fix, ensure bridges render correctly
for configs that contain `set-name`.

Fixes canonicalGH-5717
TheRealFalcon added a commit to TheRealFalcon/cloud-init that referenced this issue Oct 11, 2024
Similar to the recent sysconfig fix, ensure bridges render correctly
for configs that contain `set-name`.

Fixes canonicalGH-5717
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working correctly
Projects
None yet
Development

No branches or pull requests

3 participants