Bug 2055575

Summary: failed to disable IP of ovs and other unrelated interface at the same time
Product: Red Hat Enterprise Linux 8 Reporter: Mingyu Shi <mshi>
Component: nmstateAssignee: Gris Ge <fge>
Status: CLOSED CURRENTRELEASE QA Contact: Mingyu Shi <mshi>
Severity: medium Docs Contact:
Priority: medium    
Version: 8.6CC: ferferna, jiji, jishi, network-qe, sfaye, till
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-07-11 08:00:51 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Mingyu Shi 2022-02-17 09:42:40 UTC
Description of problem:
Failed to disable IP of ovs and other unrelated interface at the same time.
If disabling the each respectively, it won't get failed. 

Version-Release number of selected component (if applicable):
nmstate-1.2.1-1.el8.x86_64
nispor-1.2.3-1.el8.x86_64
NetworkManager-1.36.0-0.8.el8.x86_64
openvswitch2.15-2.15.0-74.el8fdp.x86_64

How reproducible:
100%

Steps to Reproduce:
new_veth()
{
    local if_up=${if_up:-yes}
    local nm_managed=${nm_managed:-yes}
    for i in `seq 0 ${1}`; do
        ip link add veth${2}${i} type veth peer name veth${2}${i}_ep
            if [ ${if_up} == 'yes' ]; then
                ip link set veth${2}${i} up
                ip link set veth${2}${i}_ep up
            fi
            if [ ${nm_managed} == 'yes' ]; then
                nmcli device set veth${2}${i} managed yes
                nmcli device set veth${2}${i}_ep managed yes
            fi
    done
}

cat << EOF > dhcpAddrOnly.yaml
interfaces:
- name: veth2
  type: ethernet
  state: up
  ipv4:
    enabled: true
    auto-dns: false
    auto-gateway: false
    auto-routes: false
    dhcp: true
  ipv6:
    enabled: true
    auto-dns: false
    auto-gateway: false
    auto-routes: false
    autoconf: false
    dhcp: true
- name: veth0_ep
  type: ethernet
  state: up
- name: veth1_ep
  type: ethernet
  state: up
- name: ovs0
  type: ovs-interface
  state: up
  ipv4:
    enabled: true
    auto-dns: false
    auto-gateway: false
    auto-routes: false
    dhcp: true
  ipv6:
    enabled: true
    auto-dns: false
    auto-gateway: false
    auto-routes: false
    autoconf: false
    dhcp: true
- name: ovs-br0
  type: ovs-bridge
  state: up
  bridge:
    port:
    - name: ovs0
    - name: veth0_ep
    - name: veth1_ep
EOF

cat << EOF > disabled.yaml
interfaces:
- name: veth2
  type: ethernet
  state: up
  ipv4:
    enabled: false
  ipv6:
    enabled: false
- name: veth0_ep
  type: ethernet
  state: up
- name: veth1_ep
  type: ethernet
  state: up
- name: ovs0
  type: ovs-interface
  state: up
  ipv4:
    enabled: false
  ipv6:
    enabled: false
- name: ovs-br0
  type: ovs-bridge
  state: up
  bridge:
    port:
    - name: ovs0
    - name: veth0_ep
    - name: veth1_ep
EOF

new_veth 2 # create 3 veth pairs
nmstatectl apply dhcpAddrOnly.yaml
nmstatectl apply disabled.yaml

Actual results:
2022-02-17 22:33:45,447 root         ERROR    Rollback failed with error Activate profile uuid:a4bf0559-c01f-424e-a1c7-0fd80ca8f7a9 iface:veth0_ep type: ethernet failed: reason=<enum NM_ACTIVE_CONNECTION_STATE_REASON_DEVICE_DISCONNECTED of type NM.ActiveConnectionStateReason><enum NM_DEVICE_STATE_REASON_DEPENDENCY_FAILED of type NM.DeviceStateReason>
Traceback (most recent call last):
  File "/usr/bin/nmstatectl", line 11, in <module>
    load_entry_point('nmstate==1.2.1', 'console_scripts', 'nmstatectl')()
  File "/usr/lib/python3.6/site-packages/nmstatectl/nmstatectl.py", line 74, in main
    return args.func(args)
  File "/usr/lib/python3.6/site-packages/nmstatectl/nmstatectl.py", line 355, in apply
    args.save_to_disk,
  File "/usr/lib/python3.6/site-packages/nmstatectl/nmstatectl.py", line 419, in apply_state
    save_to_disk=save_to_disk,
  File "/usr/lib/python3.6/site-packages/libnmstate/netapplier.py", line 89, in apply
    _apply_ifaces_state(plugins, net_state, verify_change, save_to_disk)
  File "/usr/lib/python3.6/site-packages/libnmstate/netapplier.py", line 122, in _apply_ifaces_state
    plugin.apply_changes(net_state, save_to_disk)
  File "/usr/lib/python3.6/site-packages/libnmstate/nm/plugin.py", line 233, in apply_changes
    NmProfiles(self.context).apply_config(net_state, save_to_disk)
  File "/usr/lib/python3.6/site-packages/libnmstate/nm/profiles.py", line 99, in apply_config
    self._ctx.wait_all_finish()
  File "/usr/lib/python3.6/site-packages/libnmstate/nm/context.py", line 217, in wait_all_finish
    raise tmp_error
libnmstate.error.NmstateLibnmError: Activate profile uuid:d3ac5a9a-e556-4ef5-8a73-5c1740f25dcc iface:veth1_ep type: ethernet failed: reason=<enum NM_ACTIVE_CONNECTION_STATE_REASON_UNKNOWN of type NM.ActiveConnectionStateReason><enum NM_DEVICE_STATE_REASON_REMOVED of type NM.DeviceStateReason>

Expected results:
No failure

Additional info:
If removes veth2 from `interfaces` list in disabled.yaml, it goes well then.
Not sure if it is related to https://bugzilla.redhat.com/show_bug.cgi?id=2054933 , feel free to close either one if they have the same root cause please.

Comment 1 Gris Ge 2022-07-27 08:02:02 UTC
Hi Mingyu,

I got error when trying your reproducer

[2022-07-27T08:00:21Z ERROR nmstate::ifaces::inter_ifaces_controller] InvalidArgument: Port ovs0 is overbooked by two controller: br0, ovs-br0

Could you provide another reproducer?

Meanwhile, I suspect this problem is already fixed in nmstate-2.1.3-0.20220714.81d80992.el9

Comment 2 Mingyu Shi 2022-08-08 07:18:09 UTC
(In reply to Gris Ge from comment #1)
> Hi Mingyu,
> 
> I got error when trying your reproducer
> 
> [2022-07-27T08:00:21Z ERROR nmstate::ifaces::inter_ifaces_controller]
> InvalidArgument: Port ovs0 is overbooked by two controller: br0, ovs-br0
> 
> Could you provide another reproducer?
> 
> Meanwhile, I suspect this problem is already fixed in
> nmstate-2.1.3-0.20220714.81d80992.el9

Hi Gris, I think the error is not caused by the reproducer, because there is no "br0" in it.
But it works good now, verified with
nmstate-1.3.2-1.el8.x86_64
nispor-1.2.7-1.el8.x86_64
NetworkManager-1.39.12-1.el8.x86_64
openvswitch2.15-2.15.0-114.el8fdp.x86_64

and

nmstate-2.1.3-1.el9.x86_64
NetworkManager-1.39.10-1.el9.x86_64
openvswitch2.15-2.15.0-66.el9fdp.x86_64