test__dhcp_configurations_rendered fails unable to resolve localhost when in ipv6 network

Bug #1699479 reported by Данило Шеган on 2017-06-21
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Данило Шеган

Bug Description

On my development xenial LXD container, test maasserver.tests.test_preseed_network.TestDHCPNetworkLayout.test__dhcp_configurations_rendered sometimes fails with

  "maasserver.exceptions.UnresolvableHost: No address found for host localhost."

Full traceback at: http://paste.ubuntu.com/24916451/

To ensure we test both with ipv4 and ipv6, one can apply the following patch:
(this could be done without changing the factory by pre-creating the subnet with version={4,6}, but I found this nicer)

IPv6 test *always* fails for me in a container.

The problem seems to be that maas_url in get_maas_facing_server_host() always ends up being "http://localhost:5240/MAAS" (read from RegionConfiguration), and when attempting to resolve_hostname('localhost') in get_maas_facing_server_addresses() we only allow IPv6 when trying to use MAAS address as the default DNS server.

If I hack maas_url to point to a hostname that resolves to an IPv6 address in my /etc/hosts (eg. "ip6-localhost"), the ipv4 test fails, and ipv6 test passes.

I am not sure if it makes sense to return an IPv4 nameserver (if that's the only thing we can get) to an IPv6 client? If not, we should probably only keep the ipv4 test or maybe patch resolve_hostname() to return the appropriate IP address which is either IPv4 or IPv6.

(Marking as high since it affects development)

Related branches

Changed in maas:
assignee: nobody → Данило Шеган (danilo)
status: Triaged → In Progress
Changed in maas:
status: In Progress → Fix Committed
Changed in maas:
milestone: none → 2.3.0
Changed in maas:
milestone: 2.3.0 → 2.3.0alpha2
Changed in maas:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers