Don't fail if attempting to add more resolvers (RHEL 7/CentOS 7)

Bug #1620796 reported by Bert JW Regeer on 2016-09-06
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
cloud-init
Medium
Unassigned

Bug Description

I have multiple network interfaces in OpenStack. Each defines 2 resolvers. This goes over 3 resolvers and on RHEL that leads to the following traceback:

Sep 06 13:26:03 testing02.novalocal cloud-init[362]: [CLOUDINIT] util.py[DEBUG]: Read 140 bytes from /etc/resolv.conf
Sep 06 13:26:03 testing02.novalocal cloud-init[362]: [CLOUDINIT] util.py[WARNING]: failed stage init-local
Sep 06 13:26:03 testing02.novalocal cloud-init[362]: 2016-09-06 13:26:03,786 - util.py[WARNING]: failed stage init-local
Sep 06 13:26:03 testing02.novalocal cloud-init[362]: [CLOUDINIT] util.py[DEBUG]: failed stage init-local
Sep 06 13:26:03 testing02.novalocal cloud-init[362]: failed run of stage init-local
Sep 06 13:26:03 testing02.novalocal cloud-init[362]: ------------------------------------------------------------
Sep 06 13:26:03 testing02.novalocal cloud-init[362]: Traceback (most recent call last):
Sep 06 13:26:03 testing02.novalocal cloud-init[362]: File "/usr/lib/python2.7/site-packages/cloud_init-0.7.7-py2.7.egg/cloudinit/cmd/main.py", line 530, in status_wrapper
Sep 06 13:26:03 testing02.novalocal cloud-init[362]: ret = functor(name, args)
Sep 06 13:26:03 testing02.novalocal cloud-init[362]: File "/usr/lib/python2.7/site-packages/cloud_init-0.7.7-py2.7.egg/cloudinit/cmd/main.py", line 277, in main_init
Sep 06 13:26:03 testing02.novalocal cloud-init[362]: init.apply_network_config(bring_up=bool(mode != sources.DSMODE_LOCAL))
Sep 06 13:26:03 testing02.novalocal cloud-init[362]: File "/usr/lib/python2.7/site-packages/cloud_init-0.7.7-py2.7.egg/cloudinit/stages.py", line 652, in apply_network_config
Sep 06 13:26:03 testing02.novalocal cloud-init[362]: return self.distro.apply_network_config(netcfg, bring_up=bring_up)
Sep 06 13:26:03 testing02.novalocal cloud-init[362]: File "/usr/lib/python2.7/site-packages/cloud_init-0.7.7-py2.7.egg/cloudinit/distros/__init__.py", line 162, in apply_network_config
Sep 06 13:26:03 testing02.novalocal cloud-init[362]: dev_names = self._write_network_config(netconfig)
Sep 06 13:26:03 testing02.novalocal cloud-init[362]: File "/usr/lib/python2.7/site-packages/cloud_init-0.7.7-py2.7.egg/cloudinit/distros/rhel.py", line 71, in _write_network_config
Sep 06 13:26:03 testing02.novalocal cloud-init[362]: self._net_renderer.render_network_state("/", ns)
Sep 06 13:26:03 testing02.novalocal cloud-init[362]: File "/usr/lib/python2.7/site-packages/cloud_init-0.7.7-py2.7.egg/cloudinit/net/sysconfig.py", line 395, in render_network_state
Sep 06 13:26:03 testing02.novalocal cloud-init[362]: existing_dns_path=dns_path)
Sep 06 13:26:03 testing02.novalocal cloud-init[362]: File "/usr/lib/python2.7/site-packages/cloud_init-0.7.7-py2.7.egg/cloudinit/net/sysconfig.py", line 338, in _render_dns
Sep 06 13:26:03 testing02.novalocal cloud-init[362]: content.add_nameserver(nameserver)
Sep 06 13:26:03 testing02.novalocal cloud-init[362]: File "/usr/lib/python2.7/site-packages/cloud_init-0.7.7-py2.7.egg/cloudinit/distros/parsers/resolv_conf.py", line 96, in add_nameserver
Sep 06 13:26:03 testing02.novalocal cloud-init[362]: "'3' maximum name servers") % (ns))
Sep 06 13:26:03 testing02.novalocal cloud-init[362]: ValueError: Adding u'172.17.48.4' would go beyond the '3' maximum name servers
Sep 06 13:26:03 testing02.novalocal cloud-init[362]: ------------------------------------------------------------
Sep 06 13:26:03 testing02.novalocal cloud-init[362]: [CLOUDINIT] util.py[DEBUG]: Reading from /proc/uptime (quiet=False)
Sep 06 13:26:03 testing02.novalocal cloud-init[362]: [CLOUDINIT] util.py[DEBUG]: Read 10 bytes from /proc/uptime
Sep 06 13:26:03 testing02.novalocal cloud-init[362]: [CLOUDINIT] util.py[DEBUG]: cloud-init mode 'init' took 0.509 seconds (0.51)
Sep 06 13:26:03 testing02.novalocal cloud-init[362]: [CLOUDINIT] handlers.py[DEBUG]: finish: init-local: SUCCESS: searching for local datasources
Sep 06 13:26:03 testing02.novalocal systemd[1]: cloud-init-local.service: main process exited, code=exited, status=1/FAILURE
Sep 06 13:26:03 testing02.novalocal systemd[1]: Failed to start Initial cloud-init job (pre-networking).
Sep 06 13:26:03 testing02.novalocal systemd[1]: Unit cloud-init-local.service entered failed state.
Sep 06 13:26:03 testing02.novalocal systemd[1]: cloud-init-local.service failed.

On Ubuntu the name servers are added to /etc/network/interfaces.d/50-cloud-init.cfg and resolvconf deals with setting the appropriate amount.

I believe that instead of raising a ValueError it should instead just accept the first three it receives. There is currently not a change I can make in my cloud to limit the amount of resolvers sent down because not all VM's are on both networks, and having a minimal of two DNS servers is still best practice.

Related branches

summary: - Don't fail if attempting to add more resolvers
+ Don't fail if attempting to add more resolvers (RHEL 7/CentOS 7)
Bert JW Regeer (bregeer-ctl) wrote :

Launchpad somehow can't find the branch I just pushed... but here it is:

https://code.launchpad.net/~bregeer-ctl/cloud-init/+git/cloud-init/+ref/bugfix/centos7_resolv

Scott Moser (smoser) on 2016-09-07
Changed in cloud-init:
status: New → Confirmed
importance: Undecided → Medium
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers