qa/tasks/dnsmasq: set no-resolv on the systemd-resolved path

On the systemd-resolved (debian) path, dnsmasq has only address= records
and no upstream, so queries it can't answer locally are forwarded via
/etc/resolv.conf which points back at systemd-resolved, which routes
the cname domains back to dnsmasq. The resulting loop burns a 5s
resolver retry per round trip which manifests itself in rgw s3tests
on Ubuntu running too slow hitting the job timeout.

Set no_resolv on that path so dnsmasq answers authoritatively and never
forwards. The rpm/NetworkManager path is unchanged, as dnsmasq there is
the system resolver and must forward upstream.

Fixes: https://tracker.ceph.com/issues/78572
Signed-off-by: Oguzhan Ozmen <oozmen@bloomberg.net>
This commit is contained in:
Oguzhan Ozmen 2026-07-22 14:59:35 +00:00
parent 4fab556e12
commit 2a48100588

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) ])