suse-edge / nm-configurator

NetworkManager configuration tool
Apache License 2.0
5 stars 3 forks source link

bonding: Renaming multiple interfaces not working properly #66

Open atanasdinov opened 2 months ago

atanasdinov commented 2 months ago

Input:

routes:
  config:
    - destination: 0.0.0.0/0
      metric: 100
      next-hop-address: 192.168.122.1
      next-hop-interface: bond99
      table-id: 254
    - destination: 192.168.122.0/24
      metric: 100
      next-hop-address:
      next-hop-interface: bond99
      table-id: 254
dns-resolver:
  config:
    server:
      - 192.168.122.1
      - 8.8.8.8
interfaces:
  - name: bond99
    type: bond
    state: up
    ipv4:
      address:
        - ip: 192.168.122.50
          prefix-length: 24
      enabled: true
    link-aggregation:
      mode: balance-rr
      options:
        miimon: '140'
      port:
        - eth3
        - eth2
  - name: eth2
    type: ethernet
    state: up
    mac-address: 34:8A:B1:4B:16:E7
    ipv4:
      enabled: false
    ipv6:
      enabled: false
  - name: eth3
    type: ethernet
    state: up
    mac-address: 34:8A:B1:4B:16:E8
    ipv4:
      enabled: false
    ipv6:
      enabled: false

Applying the generated configuration on a host with two Ethernet interfaces (eth0 and eth1 respectively) only results in properly renaming one of the interfaces:

node1:~ # journalctl -u combustion | grep nmc
Apr 16 16:14:57 localhost.localdomain combustion[1564]: [2024-04-16T16:14:57Z INFO  nmc::apply_conf] Identified host: node1.suse.com
Apr 16 16:14:57 localhost.localdomain combustion[1564]: [2024-04-16T16:14:57Z INFO  nmc::apply_conf] Set hostname: node1.suse.com
Apr 16 16:14:57 localhost.localdomain combustion[1564]: [2024-04-16T16:14:57Z INFO  nmc::apply_conf] Processing interface 'eth2'...
Apr 16 16:14:57 localhost.localdomain combustion[1564]: [2024-04-16T16:14:57Z INFO  nmc::apply_conf] Using interface name 'eth0' instead of the preconfigured 'eth2'
Apr 16 16:14:57 localhost.localdomain combustion[1564]: [2024-04-16T16:14:57Z INFO  nmc::apply_conf] Processing interface 'eth3'...
Apr 16 16:14:57 localhost.localdomain combustion[1564]: [2024-04-16T16:14:57Z INFO  nmc::apply_conf] Processing interface 'bond99'...
Apr 16 16:14:57 localhost.localdomain combustion[1564]: [2024-04-16T16:14:57Z INFO  nmc] Successfully applied config
node1:~ # nmcli -f NAME,UUID,TYPE,DEVICE,FILENAME con show
NAME    UUID                                  TYPE      DEVICE  FILENAME
bond99  4a920503-4862-5505-80fd-4738d07f44c6  bond      bond99  /etc/NetworkManager/system-connections/bond99.nmconnection
eth0    21373057-f376-5091-afb6-64de925c23ed  ethernet  eth0    /etc/NetworkManager/system-connections/eth0.nmconnection
eth1    25a24ec3-fed0-4735-9020-03a49d5a15ff  ethernet  eth1    /var/run/NetworkManager/system-connections/eth1.nmconnection
eth3    7e211aea-3d14-59cf-a4fa-be91dac5dbba  ethernet  --      /etc/NetworkManager/system-connections/eth3.nmconnection

node1:~ # ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master bond99 state UP group default qlen 1000
    link/ether 34:8a:b1:4b:16:e7 brd ff:ff:ff:ff:ff:ff
    altname enp1s0
3: eth1: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master bond99 state UP group default qlen 1000
    link/ether 34:8a:b1:4b:16:e7 brd ff:ff:ff:ff:ff:ff permaddr 34:8a:b1:4b:16:e8
    altname enp7s0
4: bond99: <BROADCAST,MULTICAST,MASTER,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 34:8a:b1:4b:16:e7 brd ff:ff:ff:ff:ff:ff
    inet 192.168.122.50/24 brd 192.168.122.255 scope global noprefixroute bond99
       valid_lft forever preferred_lft forever
atanasdinov commented 2 months ago

Seems to be related to bonding since the renaming works properly during combustion-prepare:

node1:~ # journalctl -u combustion-prepare
Apr 16 16:14:45 localhost systemd[1]: Starting Combustion (preparations)...
Apr 16 16:14:45 localhost combustion[809]: [2024-04-16T16:14:45Z INFO  nmc::apply_conf] Identified host: node1.suse.com
Apr 16 16:14:45 localhost combustion[809]: [2024-04-16T16:14:45Z INFO  nmc::apply_conf] Set hostname: node1.suse.com
Apr 16 16:14:45 localhost combustion[809]: [2024-04-16T16:14:45Z INFO  nmc::apply_conf] Processing interface 'eth2'...
Apr 16 16:14:45 localhost combustion[809]: [2024-04-16T16:14:45Z INFO  nmc::apply_conf] Using interface name 'eth0' instead of the preconfigured 'eth2'
Apr 16 16:14:45 localhost combustion[809]: [2024-04-16T16:14:45Z INFO  nmc::apply_conf] Processing interface 'eth3'...
Apr 16 16:14:45 localhost combustion[809]: [2024-04-16T16:14:45Z INFO  nmc::apply_conf] Using interface name 'eth1' instead of the preconfigured 'eth3'
Apr 16 16:14:45 localhost combustion[809]: [2024-04-16T16:14:45Z INFO  nmc::apply_conf] Processing interface 'bond99'...
Apr 16 16:14:45 localhost combustion[809]: [2024-04-16T16:14:45Z INFO  nmc] Successfully applied config
Apr 16 16:14:45 localhost systemd[1]: combustion-prepare.service: Deactivated successfully.
Apr 16 16:14:45 localhost systemd[1]: Finished Combustion (preparations).