The config-changed hook fails if the machine's public-address is an IPv6 one
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack Percona Cluster Charm |
Fix Released
|
Medium
|
James Page | ||
percona-cluster (Juju Charms Collection) |
Invalid
|
Medium
|
Unassigned |
Bug Description
A percona-cluster unit whose public-address is an IPv6 one will throw the following exception when running the config-changed hook:
raceback (most recent call last):
File "hooks/
main()
File "hooks/
hooks.
File "/var/lib/
self.
File "/var/lib/
return f(*args, **kwargs)
File "hooks/
hosts = get_cluster_hosts()
File "/var/lib/
hosts.
File "/var/lib/
answers = dns.resolver.
File "/usr/lib/
raise_
File "/usr/lib/
raise NXDOMAIN
dns.resolver.
juju status output from a minimal repro environment:
MODEL CONTROLLER CLOUD/REGION VERSION
repro lxd lxd/localhost 2.0-beta18
APP VERSION STATUS SCALE CHARM STORE REV OS NOTES
percona-cluster error 1 percona-cluster jujucharms 2 ubuntu
RELATION PROVIDES CONSUMES TYPE
cluster percona-cluster percona-cluster peer
UNIT WORKLOAD AGENT MACHINE PUBLIC-ADDRESS PORTS MESSAGE
percona-cluster/0 error idle 0 fd4b:abcb:
MACHINE STATE DNS INS-ID SERIES AZ
0 started fd4b:abcb:
Note that in this case, the DNS name is set to a string representation of the IP address. Regardless, line 123 of percona_utils.py can't work for IPv6:
answers = dns.resolver.
summary: |
- The config-changed hook fails if the machine's public-address is IPv6 + The config-changed hook fails if the machine's public-address is an IPv6 + one |
Changed in percona-cluster (Juju Charms Collection): | |
assignee: | nobody → Dominique Poulain (dominique-poulain) |
description: | updated |
Changed in percona-cluster (Juju Charms Collection): | |
status: | New → Confirmed |
Changed in charm-percona-cluster: | |
importance: | Undecided → Medium |
status: | New → Triaged |
Changed in percona-cluster (Juju Charms Collection): | |
status: | Triaged → Invalid |
Changed in charm-percona-cluster: | |
status: | In Progress → Fix Committed |
Changed in charm-percona-cluster: | |
milestone: | none → 17.08 |
Changed in charm-percona-cluster: | |
status: | Fix Committed → Fix Released |
I have confirmed this, it errors out as Dominique explained, unless 'prefer-ipv6' option is selected - in that case the percona won't start as it won't parse ipv6 addresses properly.
This only manifests when host is ipv6 only - in case of mixed ipv4/ipv6 setup the dns.resolver.query won't error out and the configuration will be properly created.
However, this all can be mitigated with using IPs instead of hostnames, in a manner that percona configuration (specifically the 'wsrep_ cluster_ address' option) always lists ip addresses with port numbers, like this:
wsrep_cluster_ address= gcomm:/ /a1:b1: c1:d1:4567, a2:b2:c2: d2:4567
That way the parser will first read the last colon, take the string right of it as a port number and then string right of it as the ip address (regardless of it being ipv4 or ipv6).
With this we don't need percona-cluster charm putting hostnames in configuration and adding those hostnames to /etc/hosts to make sure hostnames are properly resolved.