Bug 1944582

Summary: Cannot set DNS with DHCP on interface
Product: Red Hat Enterprise Linux 8 Reporter: Ales Musil <amusil>
Component: nmstateAssignee: Fernando F. Mancera <ferferna>
Status: CLOSED ERRATA QA Contact: Mingyu Shi <mshi>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 8.4CC: ferferna, fge, jiji, jishi, mburman, mperina, network-qe, till
Target Milestone: rcKeywords: Triaged, ZStream
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: nmstate-1.1.0-0.1.el8 Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of:
: 1961914 (view as bug list) Environment:
Last Closed: 2021-11-09 17:43:40 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:
Bug Depends On:    
Bug Blocks: 1961914    
Attachments:
Description Flags
Reproducer
none
pre-tested.log none

Description Ales Musil 2021-03-30 09:33:27 UTC
Created attachment 1767600 [details]
Reproducer

Description of problem:
Setting of static DNS with dynamic IP results in verification error.

Version-Release number of selected component (if applicable):
nmstate-1.1.0-0.20210330.1343gitc4e66f3.el8.noarch
nispor-1.0.1-4.el8.x86_64
NetworkManager-1.30.3-27812.copr.5eadbb29c7.el8.x86_64

How reproducible:
100%

Steps to Reproduce:
1. Have default route with dns on unrelated interface e.g. eth0
2. Run reproducer script


Actual results:
Traceback (most recent call last):
  File "/usr/bin/nmstatectl", line 11, in <module>
    load_entry_point('nmstate==1.1.0', 'console_scripts', 'nmstatectl')()
  File "/usr/lib/python3.6/site-packages/nmstatectl/nmstatectl.py", line 73, in main
    return args.func(args)
  File "/usr/lib/python3.6/site-packages/nmstatectl/nmstatectl.py", line 326, in set
    return apply(args)
  File "/usr/lib/python3.6/site-packages/nmstatectl/nmstatectl.py", line 343, in apply
    args.save_to_disk,
  File "/usr/lib/python3.6/site-packages/nmstatectl/nmstatectl.py", line 407, in apply_state
    save_to_disk=save_to_disk,
  File "/usr/lib/python3.6/site-packages/libnmstate/netapplier.py", line 78, in apply
    _apply_ifaces_state(plugins, net_state, verify_change, save_to_disk)
  File "/usr/lib/python3.6/site-packages/libnmstate/netapplier.py", line 134, in _apply_ifaces_state
    _verify_change(plugins, net_state)
  File "/usr/lib/python3.6/site-packages/libnmstate/netapplier.py", line 147, in _verify_change
    net_state.verify(current_state)
  File "/usr/lib/python3.6/site-packages/libnmstate/net_state.py", line 75, in verify
    self._dns.verify(current_state.get(DNS.KEY))
  File "/usr/lib/python3.6/site-packages/libnmstate/dns.py", line 196, in verify
    {DNS.KEY: cur_dns.config},
libnmstate.error.NmstateVerificationError: 
desired
=======
---
dns-resolver:
  server:
  - 1.1.1.1

current
=======
---
dns-resolver:
  search: []
  server: []

difference
==========
--- desired
+++ current
@@ -1,4 +1,4 @@
 ---
 dns-resolver:
-  server:
-  - 1.1.1.1
+  search: []
+  server: []


Expected results:
Should configure desired state.

Additional info:
The same flow was working with nmstate-0.3.

Comment 4 Fernando F. Mancera 2021-04-29 09:09:14 UTC
Upstream PR: https://github.com/nmstate/nmstate/pull/1580

Comment 5 Fernando F. Mancera 2021-05-11 08:03:38 UTC
Patch merged!

Comment 6 Mingyu Shi 2021-05-12 02:07:43 UTC
Created attachment 1782209 [details]
pre-tested.log

Pretested with versions:
nmstate-1.1.0-0.20210511.1358git3463c8e.el8.noarch
nispor-1.0.1-4.el8.x86_64
NetworkManager-1.32.0-0.2.el8.x86_64
Linux mshi-rhel-850-20210328d2 4.18.0-301.1.el8.x86_64 #1 SMP Mon Mar 29 15:21:06 EDT 2021 x86_64 x86_64 x86_64 GNU/Linux

Check the attachment:
veth0 is with a default route and unmanaged, applied DNS 1.1.1.1 and dummy0(DHCP without manual dns), 1.1.1.1 was written into dummy0 profile while veth0 stayed unmanaged

Comment 13 Mingyu Shi 2021-06-02 08:48:53 UTC
Verified with versions:
nmstate-1.1.0-0.1.el8.noarch
nispor-1.1.0-1.el8.x86_64
NetworkManager-1.32.0-0.4.el8.x86_64

Comment 15 errata-xmlrpc 2021-11-09 17:43:40 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 (nmstate bug fix and enhancement update), 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-2021:4157