Bug 1858187

Summary: RFE: Support modify dns search and server respectively
Product: Red Hat Enterprise Linux 8 Reporter: Mingyu Shi <mshi>
Component: nmstateAssignee: Gris Ge <fge>
Status: CLOSED WONTFIX QA Contact: Mingyu Shi <mshi>
Severity: low Docs Contact:
Priority: low    
Version: 8.3CC: ferferna, jiji, jishi, network-qe, till
Target Milestone: rcKeywords: FutureFeature, Triaged
Target Release: 8.5Flags: pm-rhel: mirror+
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: 2021-03-24 08:22:27 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 2020-07-17 07:03:28 UTC
Description of problem:
There are 2 issues:
1. In a scenario that people want to specify a dns suffix(search) while using dynamical dns server from DHCP server. But now when configuring dns search in nmstate, you have to configure a static dns server at the same time.
2. Now when apply an empty search config, or an empty server config, nmstate will remove both search and server config. If possible I hope I can control them respectively. This could be discussed that which method is better.

Version-Release number of selected component (if applicable):
nmstate-0.3.3-2.el8.noarch
NetworkManager-1.26.0-1.el8.x86_64
DISTRO=RHEL-8.3.0-20200716.n.0
Linux hp-dl388g8-04.rhts.eng.pek2.redhat.com 4.18.0-226.el8.x86_64 #1 SMP Wed Jul 15 07:40:39 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux


How reproducible:
100%

Steps to Reproduce:
1. Apply a dns search config, no server config
2.
3.

Actual results:
Failed

Expected results:
No failure

Additional info:
# cat only-search.yaml
---
dns-resolver:
  config:
    search:
    - veth0.lan
    - veth0.lan0
routes:
  config:
  - destination: 0.0.0.0/0
    next-hop-address: 1.0.0.254
    next-hop-interface: veth0
interfaces:
- name: veth0
  type: ethernet
  state: up
  ipv4:
    address:
    - ip: 1.0.0.1
      prefix-length: 24
    enabled: true

# nmstatectl set only-search.yaml
2020-07-17 15:01:42,104 root         DEBUG    Async action: Create checkpoint started
2020-07-17 15:01:42,107 root         DEBUG    Checkpoint None created for all devices
2020-07-17 15:01:42,107 root         DEBUG    Async action: Create checkpoint finished
2020-07-17 15:01:42,108 root         DEBUG    Async action: Add profile: veth0 started
2020-07-17 15:01:42,114 root         DEBUG    Async action: Add profile: veth0 finished
2020-07-17 15:01:42,115 root         DEBUG    Async action: Activate profile: veth0 started
2020-07-17 15:01:42,117 root         DEBUG    Connection activation initiated: dev=veth0, con-state=<enum NM_ACTIVE_CONNECTION_STATE_ACTIVATING of type NM.ActiveConnectionState>
2020-07-17 15:01:42,136 root         DEBUG    Connection activation succeeded: dev=veth0, con-state=<enum NM_ACTIVE_CONNECTION_STATE_ACTIVATED of type NM.ActiveConnectionState>, dev-state=<enum NM_DEVICE_STATE_ACTIVATED of type NM.DeviceState>, state-flags=<flags NM_ACTIVATION_STATE_FLAG_LAYER2_READY | NM_ACTIVATION_STATE_FLAG_IP4_READY | NM_ACTIVATION_STATE_FLAG_IP6_READY of type NM.ActivationStateFlags>
2020-07-17 15:01:42,136 root         DEBUG    Async action: Activate profile: veth0 finished
2020-07-17 15:01:47,351 root         DEBUG    Async action: Rollback to checkpoint /org/freedesktop/NetworkManager/Checkpoint/43 started
2020-07-17 15:01:47,357 root         DEBUG    Checkpoint /org/freedesktop/NetworkManager/Checkpoint/43 rollback executed
2020-07-17 15:01:47,357 root         DEBUG    Interface veth0 rollback succeeded
2020-07-17 15:01:47,357 root         DEBUG    Interface lo rollback succeeded
2020-07-17 15:01:47,357 root         DEBUG    Interface ens6f3 rollback succeeded
2020-07-17 15:01:47,357 root         DEBUG    Interface eno3 rollback succeeded
2020-07-17 15:01:47,357 root         DEBUG    Interface ens2f0 rollback succeeded
2020-07-17 15:01:47,357 root         DEBUG    Interface eno2 rollback succeeded
2020-07-17 15:01:47,357 root         DEBUG    Interface ens2f1 rollback succeeded
2020-07-17 15:01:47,357 root         DEBUG    Interface eno4 rollback succeeded
2020-07-17 15:01:47,358 root         DEBUG    Interface ens6f1 rollback succeeded
2020-07-17 15:01:47,358 root         DEBUG    Interface ens6f0 rollback succeeded
2020-07-17 15:01:47,358 root         DEBUG    Interface veth0_ep rollback succeeded
2020-07-17 15:01:47,358 root         DEBUG    Interface ens6f2 rollback succeeded
2020-07-17 15:01:47,358 root         DEBUG    Interface eno1 rollback succeeded
2020-07-17 15:01:47,358 root         DEBUG    Async action: Rollback to checkpoint /org/freedesktop/NetworkManager/Checkpoint/43 finished
Traceback (most recent call last):
  File "/usr/bin/nmstatectl", line 11, in <module>
    load_entry_point('nmstate==0.3.3', 'console_scripts', 'nmstatectl')()
  File "/usr/lib/python3.6/site-packages/nmstatectl/nmstatectl.py", line 67, in main
    return args.func(args)
  File "/usr/lib/python3.6/site-packages/nmstatectl/nmstatectl.py", line 256, in apply
    args.save_to_disk,
  File "/usr/lib/python3.6/site-packages/nmstatectl/nmstatectl.py", line 289, in apply_state
    save_to_disk=save_to_disk,
  File "/usr/lib/python3.6/site-packages/libnmstate/netapplier.py", line 71, in apply
    _apply_ifaces_state(plugins, net_state, verify_change, save_to_disk)
  File "/usr/lib/python3.6/site-packages/libnmstate/netapplier.py", line 115, in _apply_ifaces_state
    _verify_change(plugins, net_state)
  File "/usr/lib/python3.6/site-packages/libnmstate/netapplier.py", line 120, in _verify_change
    net_state.verify(current_state)
  File "/usr/lib/python3.6/site-packages/libnmstate/net_state.py", line 64, in verify
    self._dns.verify(current_state.get(DNS.KEY))
  File "/usr/lib/python3.6/site-packages/libnmstate/dns.py", line 191, in verify
    {DNS.KEY: self.config}, {DNS.KEY: cur_dns.config},
libnmstate.error.NmstateVerificationError: 
desired
=======
---
dns-resolver:
  search:
  - veth0.lan
  - veth0.lan0

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

difference
==========
--- desired
+++ current
@@ -1,5 +1,4 @@
 ---
 dns-resolver:
-  search:
-  - veth0.lan
-  - veth0.lan0
+  search: []
+  server: []

Comment 5 Gris Ge 2021-03-24 08:22:27 UTC
This bug as support so will break/complex current nmstate implementation -- user is required to provide full state on DNS without expecting nmstate doing merging work.

And this is no customer request for this use case.

Hence I am closing it, please feel free to reopen it when needed.