Description of problem: Failed when trying to configure host DNS. Version-Release number of selected component (if applicable): kubevirt-hyperconverged-operator.v2.6.0 OpenShift Virtualization 2.6.0 nmstate-handler version is: v2.6.0-18 How reproducible: 100% Steps to Reproduce: 1. Create NNCP: apiVersion: nmstate.io/v1beta1 kind: NodeNetworkConfigurationPolicy metadata: name: dns-network01-kjn79-worker-0-cqm4w spec: desiredState: dns-resolver: config: search: - example.com server: - 8.8.8.8 nodeSelector: kubernetes.io/hostname: network01-kjn79-worker-0-cqm4w 2. Apply the NNCMP Actual results: Failed to configured with error: message: |- error reconciling NodeNetworkConfigurationPolicy at desired state apply: , failed to execute nmstatectl set --no-commit --timeout 480: 'exit status 1' '' 'Traceback (most recent call last): File "/usr/bin/nmstatectl", line 11, in <module> load_entry_point('nmstate==0.3.4', '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 267, 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 69, in apply net_state = NetState(desired_state, current_state, save_to_disk) File "/usr/lib/python3.6/site-packages/libnmstate/net_state.py", line 58, in __init__ self._ifaces.gen_dns_metadata(self._dns, self._route) File "/usr/lib/python3.6/site-packages/libnmstate/ifaces/ifaces.py", line 379, in gen_dns_metadata iface_metadata = dns_state.gen_metadata(self, route_state) File "/usr/lib/python3.6/site-packages/libnmstate/dns.py", line 116, in gen_metadata "name servers: %s" % server libnmstate.error.NmstateValueError: Failed to find suitable interface for saving DNS name servers: 8.8.8.8
Gris, could you tell what is wrong on this config? As far as I can tell it matches https://www.nmstate.io/examples.html#dns.
(In reply to Petr Horáček from comment #1) > Gris, could you tell what is wrong on this config? As far as I can tell it > matches https://www.nmstate.io/examples.html#dns. Hi Petr, As the error message indicate, nmstate failed to find a interface for this DNS. Nmstate will need a interface for storing the DNS configuration: * Any interface with static gateway * Any interface configured as dynamic IP with 'auto-dns:False' To debug this, please provides logs before `nmstatectl set`: * nmcli * nmcli d * nmcli c * ip route * ip link * nmstatectl show Thank you!
@Meni, would you please gather logs that Gris requested?
Hi Gris, Attaching the logs requested before the `nmstatectl set`: * nmcli - http://pastebin.test.redhat.com/959501 * nmcli d - http://pastebin.test.redhat.com/959502 * nmcli c - [core@onash-48-2-svkh5-worker-0-qlp8k ~]$ nmcli c NAME UUID TYPE DEVICE Wired connection 2 d70a27b3-44c6-3497-9c8b-60500b00e4da ethernet ens3 br3 b86d469f-9918-4202-9865-4fbf06d1b1af bridge br3 ens8 b7d93ece-8362-492e-b404-c1f09d6aa11f ethernet ens8 Wired connection 4 cc35747e-4046-3eda-950e-82f204df3f50 ethernet -- * ip route - [core@onash-48-2-svkh5-worker-0-qlp8k ~]$ ip route default via 192.168.0.1 dev ens3 proto dhcp metric 101 10.128.0.0/14 dev tun0 scope link 169.254.169.254 via 192.168.0.10 dev ens3 proto dhcp metric 101 172.30.0.0/16 dev tun0 192.168.0.0/18 dev ens3 proto kernel scope link src 192.168.1.219 metric 101 * ip link - http://pastebin.test.redhat.com/959504 Let me know if you need anything else.
Hi Petr, Base on logs, The `ens3` is configured as DHCP with auto dns. And there is no interface matching the rule in: https://bugzilla.redhat.com/show_bug.cgi?id=1926143#c2 You need a static gateway interface or DHCP with auto-dns: false.
Thanks for looking into this Gris. I see. This was not clear from the error message. Could we use this to improve the error handling? It is difficult to address failed configuration based on the output of nmstatectl alone. Would it be possible to extend the message with information on what does a suitable interface looks like? So it is clear that an interface that was originally setup with DHCP cannot be used.
Meni, can we fix the test based on https://bugzilla.redhat.com/show_bug.cgi?id=1926143#c5?
Based on the comments above, this does not seem to be a bug. We only need to adjust our DNS tests.
Error message of nmstate has improved at https://github.com/nmstate/nmstate/pull/1702 The new error message will be: libnmstate.error.NmstateValueError: Failed to find suitable interface for saving DNS name servers: 8.8.8.8, nmstate only support saving DNS to interface with static gateay or auto interface with auto-dns:false
That looks awesome, thanks Gris!
The needinfo request[s] on this closed bug have been removed as they have been unresolved for 500 days