XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Undefined Undefined
    • rhos-18.0.14 FR 4
    • None
    • os-net-config
    • None
    • Moderate

      os-net-config version used:

      git clone https://github.com/karthiksundaravel/os-net-config_nmstate.git -b test_remove_con
      cd os-net-config_nmstate/
      rm -fr /usr/lib/python3.9/site-packages/os_net_config
      mv os_net_config /usr/lib/python3.9/site-packages/
      

      Having this Ethernet interface with no SR-IOV VFs initially:

      [root@compute-0 ~]# nmcli c s |grep enp6s0f3
      enp6s0f3             9d4db18f-0181-46b5-8b43-c05598bbc63e  ethernet  enp6s0f3
      
      [root@compute-0 ~]# lshw -c network -businfo |grep enp6s0f3
      pci@0000:06:00.3  enp6s0f3      network        Ethernet Controller X710 for 10GbE SFP+
      

      We keep the NM state to be used later:

      [root@compute-0 ~]# nmstatectl show enp6s0f3 > enp6s0f3.yaml
      [2025-10-01T15:31:33Z INFO  nmstatectl] Nmstate version: 2.2.50
      

      Then, we create the VFs with os-net-config:

      [root@compute-0 ~]# os-net-config -i |jq .nic10
      "enp6s0f3"
      
      [root@compute-0 ~]# cat /tmp/config-2.yaml
      network_config:
      - type: sriov_pf
        name: nic10
        mtu: 9000
        numvfs: 5
        use_dhcp: false
        defroute: false
        nm_controlled: true
        hotplug: true
        drivers_autoprobe: true
      
      [root@compute-0 ~]# >/var/log/os-net-config.log 
      
      [root@compute-0 ~]# os-net-config -p nmstate -c /tmp/config-2.yaml -d
      ...
      2025-10-01 11:34:32.741 DEBUG os_net_config.impl_nmstate.apply Updated the interfaces: 
      2025-10-01 11:34:32.741 INFO os_net_config.impl_nmstate.apply Succesfully applied the network config with nmstate provider
      2025-10-01 11:34:32.741 INFO os_net_config.config_provider nmstate: Successfully configured network_config
      2025-10-01 11:34:32.741 INFO os_net_config.main nmstate: Configured network_config successfully
      

      And we can see that the VFs have been successfully created:

      [root@compute-0 ~]# nmcli c s |grep enp6s0f3
      enp6s0f3             9d4db18f-0181-46b5-8b43-c05598bbc63e  ethernet  enp6s0f3     
      Wired connection 13  33c72ecf-ddd0-362b-98b0-8f99e1a40cd7  ethernet  enp6s0f3v2   
      Wired connection 17  060f9438-bdc2-3531-9135-bbd7a4c575a1  ethernet  enp6s0f3v3   
      Wired connection 18  78a2be7e-a0ae-37c0-a8fd-f1c4dcafbc16  ethernet  enp6s0f3v4   
      Wired connection 8   a6b03bdc-4efc-3e87-8ef3-4779eab85639  ethernet  enp6s0f3v0   
      Wired connection 9   401aacbc-04fc-3342-b56f-1829fc619256  ethernet  enp6s0f3v1
      
      [root@compute-0 ~]# lshw -c network -businfo |grep enp6s0f3
      pci@0000:06:00.3  enp6s0f3      network        Ethernet Controller X710 for 10GbE SFP+
      pci@0000:06:0e.0  enp6s0f3v0    network        Ethernet Virtual Function 700 Series
      pci@0000:06:0e.1  enp6s0f3v1    network        Ethernet Virtual Function 700 Series
      pci@0000:06:0e.2  enp6s0f3v2    network        Ethernet Virtual Function 700 Series
      pci@0000:06:0e.3  enp6s0f3v3    network        Ethernet Virtual Function 700 Series
      pci@0000:06:0e.4  enp6s0f3v4    network        Ethernet Virtual Function 700 Series
      

      The NM state also changed:

      [root@compute-0 ~]# nmstatectl show enp6s0f3 > enp6s0f3_sriov_pf.yaml
      [2025-10-01T15:36:26Z INFO  nmstatectl] Nmstate version: 2.2.50
      
      [root@compute-0 ~]# diff enp6s0f3.yaml enp6s0f3_sriov_pf.yaml
      10c10
      <   mtu: 1500
      ---
      >   mtu: 9000
      21c21
      <   accept-all-mac-addresses: false
      ---
      >   accept-all-mac-addresses: true
      78,79c78,129
      <       total-vfs: 0
      <       vfs: []
      ---
      >       total-vfs: 5
      >       vfs:
      >       - id: 0
      >         iface-name: enp6s0f3v0
      >         mac-address: F6:FA:0B:BA:BE:79
      >         spoof-check: true
      >         trust: false
      >         min-tx-rate: 0
      >         max-tx-rate: 0
      >         vlan-id: 0
      >         qos: 0
      >         vlan-proto: 802.1q
      >       - id: 1
      >         iface-name: enp6s0f3v1
      >         mac-address: 12:E1:AD:E6:99:8C
      >         spoof-check: true
      >         trust: false
      >         min-tx-rate: 0
      >         max-tx-rate: 0
      >         vlan-id: 0
      >         qos: 0
      >         vlan-proto: 802.1q
      >       - id: 2
      >         iface-name: enp6s0f3v2
      >         mac-address: BE:3E:34:1D:76:0E
      >         spoof-check: true
      >         trust: false
      >         min-tx-rate: 0
      >         max-tx-rate: 0
      >         vlan-id: 0
      >         qos: 0
      >         vlan-proto: 802.1q
      >       - id: 3
      >         iface-name: enp6s0f3v3
      >         mac-address: E6:B2:39:1D:1D:7D
      >         spoof-check: true
      >         trust: false
      >         min-tx-rate: 0
      >         max-tx-rate: 0
      >         vlan-id: 0
      >         qos: 0
      >         vlan-proto: 802.1q
      >       - id: 4
      >         iface-name: enp6s0f3v4
      >         mac-address: 16:E6:A8:9D:DB:87
      >         spoof-check: true
      >         trust: false
      >         min-tx-rate: 0
      >         max-tx-rate: 0
      >         vlan-id: 0
      >         qos: 0
      >         vlan-proto: 802.1q
      

      Now, we remove the VFs with os-net-config:

      [root@compute-0 ~]# cat /tmp/remove_config-2.yaml 
      remove_confrg:
      - remove_type: sriov_pf
        remove_name: nic10
      network_config:
      - type: interface
        name: nic10
        use_dhcp: false
      
      [root@compute-0 ~]# os-net-config -p nmstate -c /tmp/remove_config-2.yaml -d
      ...
      2025-10-01 11:38:15.771 DEBUG os_net_config.impl_nmstate.apply Updated the interfaces: enp130s0f1
      2025-10-01 11:38:15.772 INFO os_net_config.impl_nmstate.apply Succesfully applied the network config with nmstate provider
      2025-10-01 11:38:15.772 INFO os_net_config.config_provider nmstate: Successfully configured network_config
      2025-10-01 11:38:15.772 INFO os_net_config.main nmstate: Configured network_config successfully
      

      However, the VFs are still configured:

      [root@compute-0 ~]# nmcli c s |grep enp6s0f3
      enp6s0f3             9d4db18f-0181-46b5-8b43-c05598bbc63e  ethernet  enp6s0f3     
      
      [root@compute-0 ~]# lshw -c network -businfo |grep enp6s0f3
      pci@0000:06:00.3  enp6s0f3      network        Ethernet Controller X710 for 10GbE SFP+
      pci@0000:06:0e.0  enp6s0f3v0    network        Ethernet Virtual Function 700 Series
      pci@0000:06:0e.1  enp6s0f3v1    network        Ethernet Virtual Function 700 Series
      pci@0000:06:0e.2  enp6s0f3v2    network        Ethernet Virtual Function 700 Series
      pci@0000:06:0e.3  enp6s0f3v3    network        Ethernet Virtual Function 700 Series
      pci@0000:06:0e.4  enp6s0f3v4    network        Ethernet Virtual Function 700 Series
      
      [root@compute-0 ~]# nmstatectl show enp6s0f3 > enp6s0f3_after_remove_config.yaml 
      [2025-10-01T15:44:25Z INFO  nmstatectl] Nmstate version: 2.2.50
      
      [root@compute-0 ~]# diff enp6s0f3_sriov_pf.yaml enp6s0f3_after_remove_config.yaml
      (no output)
      

      Finally, we can observe that if we re-apply the original NM state for enp6s0f1 the VFs are successfully removed:

      [root@compute-0 ~]# nmstatectl apply enp6s0f3.yaml 
      [2025-10-01T15:46:50Z INFO  nmstatectl] Nmstate version: 2.2.50
      [2025-10-01T15:46:51Z INFO  nmstate::query_apply::net_state] Created checkpoint /org/freedesktop/NetworkManager/Checkpoint/155
      [2025-10-01T15:46:51Z INFO  nmstate::nm::query_apply::connection] Modifying connection 9d4db18f-0181-46b5-8b43-c05598bbc63e: enp6s0f3/802-3-ethernet
      [2025-10-01T15:46:51Z INFO  nmstate::nm::query_apply::connection] Reapplying connection 9d4db18f-0181-46b5-8b43-c05598bbc63e: enp6s0f3/802-3-ethernet
      [2025-10-01T15:46:51Z INFO  nmstate::nm::query_apply::connection] Reapply operation failed on enp6s0f3 802-3-ethernet 9d4db18f-0181-46b5-8b43-c05598bbc63e, reason: IncompatibleReapply:Can't reapply any changes to 'ethtool' setting, retry on normal activation
      [2025-10-01T15:46:53Z INFO  nmstate::query_apply::net_state] Retrying on: VerificationError: Verification failure: enp6s0f3.interface.mtu desire '1500', current '9000'
      [2025-10-01T15:46:55Z INFO  nmstate::query_apply::net_state] Destroyed checkpoint /org/freedesktop/NetworkManager/Checkpoint/155
      route-rules: {}
      routes: {}
      interfaces:
      - name: enp6s0f3
        type: ethernet
        state: up
        mtu: 1500
        accept-all-mac-addresses: false
        ethernet:
          sr-iov:
            total-vfs: 0
            vfs: []
      ovn: {}
      
      
      [root@compute-0 ~]# lshw -c network -businfo |grep enp6s0f3
      pci@0000:06:00.3  enp6s0f3      network        Ethernet Controller X710 for 10GbE SFP+
      

        1. config-2.yaml
          0.2 kB
        2. config-2-1.yaml
          0.2 kB
        3. enp6s0f3_sriov_pf.yaml
          3 kB
        4. enp6s0f3.yaml
          2 kB
        5. os-net-config.log
          171 kB
        6. remove_config-2.yaml
          0.1 kB

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

                Created:
                Updated:
                Resolved: