Bug 1926143 - knmstate: failed to configure DNS on node
Summary: knmstate: failed to configure DNS on node
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Container Native Virtualization (CNV)
Classification: Red Hat
Component: Networking
Version: 2.4.6
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: ---
: 4.9.0
Assignee: Petr Horáček
QA Contact: awax
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-02-08 10:42 UTC by Meni Yakove
Modified: 2023-09-15 01:00 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-09-13 12:49:26 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Meni Yakove 2021-02-08 10:42:20 UTC
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

Comment 1 Petr Horáček 2021-02-08 14:54:26 UTC
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.

Comment 2 Gris Ge 2021-03-22 05:14:33 UTC
(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!

Comment 3 Petr Horáček 2021-04-09 10:41:32 UTC
@Meni, would you please gather logs that Gris requested?

Comment 4 Ofir Nash 2021-04-28 10:06:22 UTC
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.

Comment 5 Gris Ge 2021-07-20 07:46:42 UTC
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.

Comment 6 Petr Horáček 2021-07-20 11:03:40 UTC
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.

Comment 8 Petr Horáček 2021-09-01 14:55:21 UTC
Meni, can we fix the test based on https://bugzilla.redhat.com/show_bug.cgi?id=1926143#c5?

Comment 9 Petr Horáček 2021-09-02 10:32:36 UTC
Based on the comments above, this does not seem to be a bug. We only need to adjust our DNS tests.

Comment 10 Gris Ge 2021-09-08 05:32:16 UTC
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

Comment 11 Petr Horáček 2021-09-08 06:55:08 UTC
That looks awesome, thanks Gris!

Comment 12 Red Hat Bugzilla 2023-09-15 01:00:41 UTC
The needinfo request[s] on this closed bug have been removed as they have been unresolved for 500 days


Note You need to log in before you can comment on or make changes to this bug.