canonical / canonical/cloud-init
Don't fail if attempting to add more resolvers (RHEL 7/CentOS 7)
- Dominant language
- Python
- Stars
- 3.8k
- Forks
- 1.1k
- Avg merge
- 2d 23h
- Merged PRs (30d)
- 18
Description
This bug was originally filed in Launchpad as [LP: #1620796](https://bugs.launchpad.net/cloud-init/+bug/1620796)
Launchpad details
affected_projects = []
assignee = None
assignee_name = None
date_closed = None
date_created = 2016-09-06T19:41:16.947301+00:00
date_fix_committed = None
date_fix_released = None
id = 1620796
importance = medium
is_complete = False
lp_url = https://bugs.launchpad.net/cloud-init/+bug/1620796
milestone = None
owner = bregeer-ctl
owner_name = Bert JW Regeer
private = False
status = confirmed
submitter = bregeer-ctl
submitter_name = Bert JW Regeer
tags = ['centos', 'rhel']
duplicates = []
_Launchpad user **Bert JW Regeer(bregeer-ctl)** wrote on 2016-09-06T19:41:16.947301+00:00_
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.
Contributor guide
Assessment
This issue has not been assessed yet.