Merge pull request #70449 from BBoozmen/wip-oozmen-78572

qa/tasks/dnsmasq: set no-resolv on the systemd-resolved path
This commit is contained in:
Oguzhan Ozmen 2026-07-27 09:22:26 -04:00 committed by GitHub
commit 993f3f7c50
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -31,12 +31,18 @@ def install_dnsmasq(remote):
packaging.remove_package('dnsmasq', remote)
@contextlib.contextmanager
def configure_dnsmasq(remote, path, cnames):
def configure_dnsmasq(remote, path, cnames, no_resolv=False):
"""
configure dnsmasq on the given remote, adding each cname given
When no_resolv is set, dnsmasq will not forward unmatched queries upstream
via /etc/resolv.conf. This is needed on the systemd-resolved path: resolved
routes the cname domains to dnsmasq, but /etc/resolv.conf points back at
resolved, so forwarding would form a query loop that stalls resolution.
"""
data = """# This file is generated by dnsmasq teuthology task
"""
data = "# This file is generated by dnsmasq teuthology task\n"
if no_resolv:
data += "no-resolv\n"
for cname, ip_address in cnames.items():
data += f"address=/.{cname}/{ip_address}\n"
@ -171,7 +177,8 @@ def task(ctx, config):
subtasks.extend([ lambda r=remote: configure_network_manager(r) ])
else:
path = '/etc/dnsmasq.d/ceph.conf'
subtasks.extend([ lambda r=remote, p=path, cn=cnames: configure_dnsmasq(r, p, cn) ])
# no_resolv avoids a resolv.conf <-> resolved query loop, see configure_dnsmasq() docstring
subtasks.extend([ lambda r=remote, p=path, cn=cnames: configure_dnsmasq(r, p, cn, no_resolv=True) ])
subtasks.extend([ lambda r=remote, cn=cnames: configure_systemd_resolved(r, cn) ])
subtasks.extend([ lambda r=remote, cn=cnames: test_dns_names(r, cn) ])