Bug 1722744

Summary: dummy can't be set down with nmstatectl soon after it is created
Product: Red Hat Enterprise Linux 8 Reporter: Jianlin Shi <jishi>
Component: nmstateAssignee: Gris Ge <fge>
Status: CLOSED ERRATA QA Contact: Mingyu Shi <mshi>
Severity: medium Docs Contact:
Priority: medium    
Version: 8.1CC: network-qe, rkhan
Target Milestone: rc   
Target Release: 8.2   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: nmstate-0.2.3-1.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-04-28 16:00:05 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 Jianlin Shi 2019-06-21 07:09:58 UTC
Description of problem:
dummy can't be set down with nmstatectl soon after it is created

Version-Release number of selected component (if applicable):
nmstate-0.0.7-1.el8.noarch

How reproducible:
Always

Steps to Reproduce:
#!/bin/bash

cat > dummy1_test.yaml << EOF
---
dns-resolver:
  config:
    search: []
    server: []
  running:
    search:
    - rhts.eng.pek2.redhat.com
    server:
    - 10.73.2.107
    - 10.73.2.108
    - 10.10.160.1
routes:
  config: []
  running:
  - destination: 1.1.1.0/24
    metric: 550
    next-hop-address: ''
    next-hop-interface: dummy1
    table-id: 254
  - destination: fe80::/64
    metric: 550
    next-hop-address: ''
    next-hop-interface: dummy1
    table-id: 254
  - destination: ff00::/8
    metric: 256
    next-hop-address: ''
    next-hop-interface: dummy1
    table-id: 255
interfaces:
- name: dummy1
  type: dummy
  state: up
  ipv4:
    address:
    - ip: 1.1.1.1
      prefix-length: 24
    dhcp: false
    enabled: true
  ipv6:
    address:
    - ip: fe80::4b56:deb5:1f47:20c8
      prefix-length: 64
    autoconf: false
    dhcp: false
    enabled: true
  mac-address: CE:6E:CD:16:69:21
  mtu: 1600
EOF

nmstatectl set dummy1_test.yaml
sed -i 's/state: up/state: down/' dummy1_test.yaml
nmstatectl set dummy1_test.yaml
sleep 10
nmstatectl set dummy1_test.yaml

Actual results:
fail to set down for the first time

Expected results:
can be set down

Additional info:

+ sed -i 's/state: up/state: down/' dummy1_test.yaml
+ nmstatectl set dummy1_test.yaml
2019-06-21 03:07:10,268 root         DEBUG    Checkpoint /org/freedesktop/NetworkManager/Checkpoint/275 created for all devices: 60
2019-06-21 03:07:10,269 root         DEBUG    Adding new interfaces: []
2019-06-21 03:07:10,296 root         DEBUG    Editing interfaces: ['dummy1']
2019-06-21 03:07:10,299 root         DEBUG    Executing NM action: func=_safe_deactivate_async
2019-06-21 03:07:10,310 root         DEBUG    Connection deactivation succeeded on dummy1
2019-06-21 03:07:10,310 root         DEBUG    Executing NM action: func=_safe_delete_async
2019-06-21 03:07:10,336 root         DEBUG    Connection deletion succeeded: dev=dummy1
2019-06-21 03:07:10,336 root         DEBUG    NM action queue exhausted, quiting mainloop
2019-06-21 03:07:10,436 root         DEBUG    Checkpoint /org/freedesktop/NetworkManager/Checkpoint/275 rollback executed: dbus.Dictionary({dbus.String('/org/freedesktop/NetworkManager/Devices/134'): dbus.UInt32(0), dbus.String('/org/freedesktop/NetworkManager/Devices/1'): dbus.UInt32(0), dbus.String('/org/freedesktop/NetworkManager/Devices/2'): dbus.UInt32(0)}, signature=dbus.Signature('su'))
Traceback (most recent call last):
  File "/usr/bin/nmstatectl", line 11, in <module>
    load_entry_point('nmstate==0.0.7', 'console_scripts', 'nmstatectl')()
  File "/usr/lib/python3.6/site-packages/nmstatectl/nmstatectl.py", line 59, in main
    return args.func(args)
  File "/usr/lib/python3.6/site-packages/nmstatectl/nmstatectl.py", line 187, in apply
    args.timeout)
  File "/usr/lib/python3.6/site-packages/nmstatectl/nmstatectl.py", line 206, in apply_state
    checkpoint = libnmstate.apply(state, verify_change, commit, timeout)
  File "/usr/lib/python3.6/site-packages/libnmstate/netapplier.py", line 59, in apply
    state.State(desired_state), verify_change, commit, rollback_timeout)
  File "/usr/lib/python3.6/site-packages/libnmstate/netapplier.py", line 134, in _apply_ifaces_state
    _verify_change(desired_state)
  File "/usr/lib/python3.6/site-packages/libnmstate/netapplier.py", line 171, in _verify_change
    desired_state.verify_interfaces(current_state)
  File "/usr/lib/python3.6/site-packages/libnmstate/state.py", line 219, in verify_interfaces
    self._assert_interfaces_included_in(other_state)
  File "/usr/lib/python3.6/site-packages/libnmstate/state.py", line 448, in _assert_interfaces_included_in
    current_state.interfaces))
libnmstate.error.NmstateVerificationError:
desired
=======
---
dummy1:
  ipv4:
    address:
    - ip: 1.1.1.1
      prefix-length: 24
    dhcp: false
    enabled: true
  ipv6:
    address:
    - ip: fe80::4b56:deb5:1f47:20c8
      prefix-length: 64
    autoconf: false
    dhcp: false
    enabled: true
  mac-address: CE:6E:CD:16:69:21
  mtu: 1600
  name: dummy1
  state: down
  type: dummy

current
=======
---
ens3:
  ipv4:
    address:
    - ip: 10.73.4.124
      prefix-length: 23
    auto-dns: true
    auto-gateway: true
    auto-routes: true
    dhcp: true
    enabled: true
  ipv6:
    address:
    - ip: 2620:52:0:4904:5054:ff:feb7:7d2e
      prefix-length: 64
    - ip: fe80::5054:ff:feb7:7d2e
      prefix-length: 64
    auto-dns: true
    auto-gateway: true
    auto-routes: true
    autoconf: true
    dhcp: true
    enabled: true
  mac-address: 52:54:00:B7:7D:2E
  mtu: 1500
  name: ens3
  state: up
  type: ethernet
lo:
  ipv4:
    enabled: false
  ipv6:
    enabled: false
  mtu: 65536
  name: lo
  state: down
  type: unknown

difference
==========
--- desired
+++ current
@@ -1,20 +1,37 @@
 ---
-dummy1:
+ens3:
   ipv4:
     address:
-    - ip: 1.1.1.1
-      prefix-length: 24
-    dhcp: false
+    - ip: 10.73.4.124
+      prefix-length: 23
+    auto-dns: true
+    auto-gateway: true
+    auto-routes: true
+    dhcp: true
     enabled: true
   ipv6:
     address:
-    - ip: fe80::4b56:deb5:1f47:20c8
+    - ip: 2620:52:0:4904:5054:ff:feb7:7d2e
       prefix-length: 64
-    autoconf: false
-    dhcp: false
+    - ip: fe80::5054:ff:feb7:7d2e
+      prefix-length: 64
+    auto-dns: true
+    auto-gateway: true
+    auto-routes: true
+    autoconf: true
+    dhcp: true
     enabled: true
-  mac-address: CE:6E:CD:16:69:21
-  mtu: 1600
-  name: dummy1
+  mac-address: 52:54:00:B7:7D:2E
+  mtu: 1500
+  name: ens3
+  state: up
+  type: ethernet
+lo:
+  ipv4:
+    enabled: false
+  ipv6:
+    enabled: false
+  mtu: 65536
+  name: lo
   state: down
-  type: dummy
+  type: unknown

<==== failed for the first time

+ sleep 10
+ nmstatectl set dummy1_test.yaml
2019-06-21 03:07:21,400 root         DEBUG    Checkpoint /org/freedesktop/NetworkManager/Checkpoint/276 created for all devices: 60
2019-06-21 03:07:21,400 root         DEBUG    Adding new interfaces: []
2019-06-21 03:07:21,428 root         DEBUG    Editing interfaces: ['dummy1']
2019-06-21 03:07:21,432 root         DEBUG    Executing NM action: func=_safe_deactivate_async
2019-06-21 03:07:21,451 root         DEBUG    Connection deactivation succeeded on dummy1
2019-06-21 03:07:21,451 root         DEBUG    Executing NM action: func=_safe_delete_async
2019-06-21 03:07:21,458 root         DEBUG    Connection deletion succeeded: dev=dummy1
2019-06-21 03:07:21,458 root         DEBUG    NM action queue exhausted, quiting mainloop
2019-06-21 03:07:21,497 root         DEBUG    Checkpoint /org/freedesktop/NetworkManager/Checkpoint/276 destroyed
Desired state applied:
---
dns-resolver:
  config:
    search: []
    server: []
  running:
    search:
    - rhts.eng.pek2.redhat.com
    server:
    - 10.73.2.107
    - 10.73.2.108
    - 10.10.160.1
routes:
  config: []
  running:
  - destination: 1.1.1.0/24
    metric: 550
    next-hop-address: ''
    next-hop-interface: dummy1
    table-id: 254
  - destination: fe80::/64
    metric: 550
    next-hop-address: ''
    next-hop-interface: dummy1
    table-id: 254
  - destination: ff00::/8
    metric: 256
    next-hop-address: ''
    next-hop-interface: dummy1
    table-id: 255
interfaces:
- name: dummy1
  type: dummy
  state: down
  ipv4:
    address:
    - ip: 1.1.1.1
      prefix-length: 24
    dhcp: false
    enabled: true
  ipv6:
    address:
    - ip: fe80::4b56:deb5:1f47:20c8
      prefix-length: 64
    autoconf: false
    dhcp: false
    enabled: true
  mac-address: CE:6E:CD:16:69:21
  mtu: 1600

<==== passed when try after 10 seconds

Comment 6 errata-xmlrpc 2020-04-28 16:00:05 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2020:1696