undercloud subnet dns_nameservers option default overrides undercloud_nameservers in global conf

Bug #1848517 reported by Harald Jensås
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
tripleo
Invalid
High
Harald Jensås

Bug Description

Using 'undercloud_nameservers' in global config broken by mistake in https://review.opendev.org/#/c/667380?

 Related Infrared change: https://review.gerrithub.io/c/redhat-openstack/infrared/+/471626

UPDATE:
 constants.CTLPLANE_DNS_NAMESERVERS_DEFAULT = []

This is the default for [ctlplane-subnet]/dns_nameservers

Code[1] - should set 'undercloud_nameservers' if [ctlplane-subnet]/dns_nameservers is not-set (i.e default [])
        if s.get('dns_nameservers'):
            env['UndercloudCtlplaneSubnets'][subnet].update(
                {'DnsNameServers': s['dns_nameservers']})
        else:
            env['UndercloudCtlplaneSubnets'][subnet].update(
                {'DnsNameServers': CONF['undercloud_nameservers']})

It is possible this worked in CI because of this script that removed test coverage in CI executes:
https://review.opendev.org/#/c/296362/3/scripts/tripleo.sh

[1] https://opendev.org/openstack/python-tripleoclient/src/branch/master/tripleoclient/v1/undercloud_config.py#L340-L345

Changed in tripleo:
status: Triaged → Incomplete
description: updated
Changed in tripleo:
importance: Undecided → High
Revision history for this message
Harald Jensås (harald-jensas) wrote :

We have unit test coverage that show's that setting the subnets dns_nameserver = [] and undercloud_nameservers = ['10.10.10.10', '10.10.10.11'] set 'DnsNameServers': ['10.10.10.10', '10.10.10.11'].

https://opendev.org/openstack/python-tripleoclient/src/branch/master/tripleoclient/tests/v1/undercloud/test_config.py#L129
https://opendev.org/openstack/python-tripleoclient/src/branch/master/tripleoclient/tests/v1/undercloud/test_config.py#L175

The reporter tell me overcloud nodes got 192.168.24.5 as nameserver. constants.CTLPLANE_DHCP_START_DEFAULT = ['192.168.24.5'], if no nameserver is specified when creating the subnet neutron probably default to the IP address of the dhcp agent's dnsmasq which is the first address of the allocation pool.

The reporter assure's me that undercloud_nameservers = 10.10.160.1 is set in undercloud.conf.

description: updated
Revision history for this message
Harald Jensås (harald-jensas) wrote :

Trying to reproduce with
########################

file: undercloud.conf
-------------------------------------------------------------------
[DEFAULT]

local_interface = eth1
local_ip = 172.20.0.1/26
undercloud_admin_host = 172.20.0.2
undercloud_hostname = leafs.lab.example.com
undercloud_nameservers = 172.20.0.254
undercloud_ntp_servers = 0.se.pool.ntp.org
undercloud_public_host = 172.20.0.3
undercloud_debug = true

[ctlplane-subnet]
cidr = 172.20.0.0/26
dhcp_start = 172.20.0.10
dhcp_end = 172.20.0.19
inspection_iprange = 172.20.0.20,172.20.0.29
gateway = 172.20.0.62
masquerade = true
-------------------------------------------------------------------

Result
######

file: tripleo-config-generated-env-files/undercloud_parameters.yaml
-------------------------------------------------------------------
  UndercloudCtlplaneSubnets:
    ctlplane-subnet:
      AllocationPools:
      - end: 172.20.0.19
        start: 172.20.0.10
      DnsNameServers:
      - 172.20.0.254 <-- DnsNameservers == undercloud_nameservers
      HostRoutes: []
      NetworkCidr: 172.20.0.0/26
      NetworkGateway: 172.20.0.62
-------------------------------------------------------------------

(undercloud) [stack@leafs ~]$ openstack subnet show ctlplane-subnet -c dns_nameservers
+-----------------+--------------+
| Field | Value |
+-----------------+--------------+
| dns_nameservers | 172.20.0.254 |
+-----------------+--------------+

Revision history for this message
Harald Jensås (harald-jensas) wrote :
Changed in tripleo:
status: Incomplete → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.