Uploaded image for project: 'Red Hat OpenStack Services on OpenShift'
  1. Red Hat OpenStack Services on OpenShift
  2. OSPRH-20738

Unexpected os-net-config remove_config behavior with ifcfg provider

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Undefined Undefined
    • rhos-18.0.14 FR 4
    • None
    • os-net-config
    • None
    • Important

      We'll be using nic3 (enp130s0f0) and nic4 (enp130s0f0):

      [root@compute-1 ~]# os-net-config -p ifcfg -i -m /var/tmp/os-net-config_tests/mapping.yaml
      {"nic2": "eno2", "nic3": "enp130s0f0", "nic4": "enp130s0f1", "nic5": "enp130s0f2", "nic6": "enp130s0f3", "nic7": "enp6s0f0", "nic8": "enp6s0f1", "nic9": "enp6s0f2", "nic10": "enp6s0f3", "nic11": "enp4s0f0np0", "nic12": "enp4s0f1np1", "nic1": "eno1"}
      

      Initially, we have the ifcfg configuration file created by cloud-init for the (provision) control plane interface:

      [root@compute-1 ~]# ls -lrhta /etc/sysconfig/network-scripts/*-enp130s0f{0,1}
      ls: cannot access '/etc/sysconfig/network-scripts/*-enp130s0f1': No such file or directory
      -rw-r--r--. 1 root root 228 Oct  9 07:41  /etc/sysconfig/network-scripts/ifcfg-enp130s0f0
      

      Then, we run os_net_config to configure the (same) control plane interface:

      [root@compute-1 ~]# cat /var/tmp/os-net-config_tests/config-ctlplane.yaml
      network_config:
      - type: interface
        name: nic3
        use_dhcp: false
        dns_servers:
        - 192.168.122.80
        addresses:
        - ip_netmask: 192.168.122.101/24
        routes:
        - default: true
          next_hop: 192.168.122.1
      
      [root@compute-1 ~]# os-net-config -p ifcfg -m /var/tmp/os-net-config_tests/mapping.yaml -c /var/tmp/os-net-config_tests/config-ctlplane.yaml -d
      ...
      2025-10-09 08:13:06.606 INFO os_net_config.config_provider ifcfg: Successfully configured network_config
      2025-10-09 08:13:06.606 INFO os_net_config.main ifcfg: Configured network_config successfully
      

      At this point, everything works as expected:

      [root@compute-1 ~]# ip a |grep 192.168.122.101 -B2
      11: enp130s0f0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
          link/ether f8:f2:1e:33:04:e0 brd ff:ff:ff:ff:ff:ff
          inet 192.168.122.101/24 brd 192.168.122.255 scope global noprefixroute enp130s0f0
      
      [root@compute-1 ~]# ls -lrhta /etc/sysconfig/network-scripts/*-enp130s0f{0,1}
      ls: cannot access '/etc/sysconfig/network-scripts/*-enp130s0f1': No such file or directory
      -rw-r--r--. 1 root root  41 Oct  9 08:13  /etc/sysconfig/network-scripts/route-enp130s0f0
      -rw-r--r--. 1 root root 185 Oct  9 08:13  /etc/sysconfig/network-scripts/ifcfg-enp130s0f0
      
      [root@compute-1 ~]# cat /etc/sysconfig/network-scripts/ifcfg-enp130s0f0
      # This file is autogenerated by os-net-config
      DEVICE=enp130s0f0
      ONBOOT=yes
      HOTPLUG=no
      NM_CONTROLLED=no
      BOOTPROTO=static
      IPADDR=192.168.122.101
      NETMASK=255.255.255.0
      DNS1=192.168.122.80
      
      [root@compute-1 ~]# cat /etc/sysconfig/network-scripts/route-enp130s0f0
      default via 192.168.122.1 dev enp130s0f0
      

      (By the way, I believe route-enp130s0f0 should also have the # This file is autogenerated by os-net-config header)

      Then we apply the following configuration to remove the nic3 configuration (successfully applied apparently):

      [root@compute-1 ~]# cat /var/tmp/os-net-config_tests/config_remove-ctlplane.yaml
      remove_config:
      - remove_type: interface
        remove_name: nic3
      network_config:
      - type: interface
        name: nic4 
        use_dhcp: false
        dns_servers: 
        - 192.168.122.80
        addresses: 
        - ip_netmask: 192.168.122.101/24
        routes: 
        - default: true
          next_hop: 192.168.122.1
      
      [root@compute-1 ~]# os-net-config -p ifcfg -m /var/tmp/os-net-config_tests/mapping.yaml -c /var/tmp/os-net-config_tests/config_remove-ctlplane.yaml
      ...
      2025-10-09 08:27:43.140 DEBUG os_net_config.impl_ifcfg.add_interface interface data: # This file is autogenerated by os-net-config
      DEVICE=enp4s0f1np1
      ONBOOT=yes
      HOTPLUG=no
      NM_CONTROLLED=no
      BOOTPROTO=static
      IPADDR=192.168.122.101
      NETMASK=255.255.255.0
      DNS1=192.168.122.80
      
      2025-10-09 08:27:43.140 INFO os_net_config.impl_ifcfg._add_routes enp4s0f1np1: adding custom route
      2025-10-09 08:27:43.140 DEBUG os_net_config.impl_ifcfg._add_routes enp4s0f1np1: route data: default via 192.168.122.1 dev enp4s0f1np1
      
      2025-10-09 08:27:43.140 DEBUG os_net_config.impl_ifcfg._add_routes enp4s0f1np1: ipv6 route data: 
      2025-10-09 08:27:43.140 INFO os_net_config.impl_ifcfg.apply applying network configs...
      2025-10-09 08:27:43.140 INFO os_net_config.impl_ifcfg.apply enp4s0f1np1: No changes required for interface
      2025-10-09 08:27:43.141 DEBUG os_net_config.utils.diff Diff file data:
      default via 192.168.122.1 dev enp4s0f1np1
      
      2025-10-09 08:27:43.141 DEBUG os_net_config.utils.diff Diff data:
      default via 192.168.122.1 dev enp4s0f1np1
      
      2025-10-09 08:27:43.141 DEBUG os_net_config.utils.diff Diff file data:
      
      2025-10-09 08:27:43.141 DEBUG os_net_config.utils.diff Diff data:
      
      2025-10-09 08:27:43.141 DEBUG os_net_config.utils.diff Diff file data:
      
      2025-10-09 08:27:43.141 DEBUG os_net_config.utils.diff Diff data:
      
      2025-10-09 08:27:43.142 INFO os_net_config.config_provider ifcfg: Successfully configured network_config
      2025-10-09 08:27:43.142 INFO os_net_config.main ifcfg: Configured network_config successfully
      

      However, it seems that the former nic12 (enp4s0f1np1) is re-mapped to nic3 and added to network-scripts:

      [root@compute-1 ~]# ls -lrhta /etc/sysconfig/network-scripts/*-enp*
      -rw-r--r--. 1 root root  41 Oct  9 08:13 /etc/sysconfig/network-scripts/route-enp130s0f0
      -rw-r--r--. 1 root root 185 Oct  9 08:13 /etc/sysconfig/network-scripts/ifcfg-enp130s0f0
      -rw-r--r--. 1 root root 186 Oct  9 08:23 /etc/sysconfig/network-scripts/ifcfg-enp4s0f1np1
      -rw-r--r--. 1 root root  42 Oct  9 08:23 /etc/sysconfig/network-scripts/route-enp4s0f1np1
      
      [root@compute-1 ~]# cat /etc/sysconfig/network-scripts/ifcfg-enp4s0f1np1
      # This file is autogenerated by os-net-config
      DEVICE=enp4s0f1np1
      ONBOOT=yes
      HOTPLUG=no
      NM_CONTROLLED=no
      BOOTPROTO=static
      IPADDR=192.168.122.101
      NETMASK=255.255.255.0
      DNS1=192.168.122.80
      
      [root@compute-1 ~]# cat /etc/sysconfig/network-scripts/route-enp4s0f1np1
      default via 192.168.122.1 dev enp4s0f1np1
      

      Although the control plane IP is still kept in nic3:

      [root@compute-1 ~]# ip a |grep 192.168.122.101 -B2
      11: enp130s0f0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
          link/ether f8:f2:1e:33:04:e0 brd ff:ff:ff:ff:ff:ff
          inet 192.168.122.101/24 brd 192.168.122.255 scope global noprefixroute enp130s0f0
      

        1. os-net-config-config_remove-ctlplane.log
          39 kB
        2. mapping.yaml
          0.2 kB
        3. config-ctlplane.yaml
          0.2 kB
        4. config_remove-ctlplane.yaml
          0.3 kB

              ksundara@redhat.com Karthik Sundaravel
              rdiazcam@redhat.com Ricardo Diaz Campos
              rhos-dfg-nfv
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated: