commission fails if `maas-url` uses an IPv6
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
MAAS |
Fix Released
|
High
|
Christian Grabowski |
Bug Description
When MAAS is configured with a `maas-url` using IPv6 (like `http://[::]:5240/MAAS`), deploying a VM fails.
Here is how to reproduce the issue
1) Save and execute the attached reproducer script
$ sh -x reproducer
2) Workaround a problem enabling DHCP
$ lxc exec maas -- maas admin vlan update -d 1 untagged dhcp_on=True primary_rack=maas
3) Log to MAAS' UI to finish the initial configuration
4) Commission `vm01`
5) Deploy `vm01` using 20.04
6) Check the deployment progress/fail using LXD VGA console
$ lxc console --type vga vm01
When the deploy fails, the regiond.log contains this:
$ lxc exec maas -- cat /var/snap/
...
2023-05-19 01:04:48 regiond: [info] 127.0.0.1 POST /MAAS/metadata/
2023-05-19 01:04:48 regiond: [info] 127.0.0.1 POST /MAAS/metadata/
2023-05-19 01:04:48 regiond: [info] 127.0.0.1 POST /MAAS/metadata/
2023-05-19 01:04:48 maasserver.preseed: [warn] WARNING: '/snap/
2023-05-19 01:04:48 maasserver: [error] #######
2023-05-19 01:04:48 maasserver: [error] Traceback (most recent call last):
File "/snap/
ips = get_maas_
File "/snap/
addresses = resolve_hostname(
File "/snap/
address_info = resolve_
File "/snap/
address_info = getaddrinfo(
File "/usr/lib/
for res in _socket.
socket.gaierror: [Errno -9] Address family for hostname not supported
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/snap/
response = wrapped_
File "/snap/
return view_atomic(*args, **kwargs)
File "/usr/lib/
return func(*args, **kwds)
File "/snap/
response = super()
File "/snap/
response = func(*args, **kwargs)
File "/snap/
result = self.error_
File "/snap/
result = meth(request, *args, **kwargs)
File "/snap/
return function(self, request, *args, **kwargs)
File "/snap/
user_data = get_curtin_
File "/snap/
configs=
File "/snap/
network_config = compose_
File "/snap/
generator = NodeNetworkConf
File "/snap/
self.
File "/snap/
maas_
File "/snap/
raise UnresolvableHost(
maasserver.
2023-05-19 01:04:48 regiond: [info] 127.0.0.1 POST /MAAS/metadata/
2023-05-19 01:04:49 regiond: [info] 127.0.0.1 POST /MAAS/metadata/
Current workaround is to use a different `maas-url` using an IPv4 like `http://
The problem was reproduced with MAAS snap channel `3.3/stable` and `3.4/beta`.
Additional information:
$ lxc exec maas -- snap list maas
Name Version Rev Tracking Publisher Notes
maas 3.4.0~beta1-
Related branches
- MAAS Lander: Approve
- Alexsander de Souza: Approve
-
Diff: 177 lines (+97/-5)2 files modifiedsrc/provisioningserver/utils/network.py (+37/-2)
src/provisioningserver/utils/tests/test_network.py (+60/-3)
tags: | added: lxd-cloud |
Changed in maas: | |
milestone: | none → 3.5.0 |
status: | In Progress → Fix Committed |
Changed in maas: | |
milestone: | 3.5.0 → 3.5.0-beta1 |
status: | Fix Committed → Fix Released |
It appears the issue is `socket. getaddrinfo( )` does not work for IPv6 only hosts (links for context https:/ /github. com/python/ cpython/ issues/ 54623, https:/ /github. com/python/ cpython/ issues/ 82082, and https:/ /bugs.python. org/issue10414). And while it does work for dual stack hosts, it seems until `socket. getaddrinfo( )` is fixed (see latter of the github issues linked) using a higher level function to resolve the address info should work.
Marking as triaged