[Bug 1538812] Re: Relies on DNS to resolve own hostname

Florian Haas florian at hastexo.com
Thu Jan 28 19:04:46 UTC 2016


The problem pops up when using the "manual" provider. I've just spun up
a simplified test environment to confirm the problem; the exact Juju
config is here if it helps: https://www.hastexo.com/resources/hints-and-
kinks/ubuntu-openstack-juju-4-nodes/

After running that setup, cinder-volume and neutron-gateway are broken:

$ juju stat neutron-gateway --format=oneline

- neutron-gateway/0: charlie.example.com (error)

$ juju stat cinder-volume --format=oneline

- cinder-volume/0: daisy.example.com (error)

$ juju debug-log --replay | grep NXDOMAIN
unit-neutron-gateway-0[22632]: 2016-01-28 18:50:56 INFO unit.neutron-gateway/0.install logger.go:40     raise NXDOMAIN
unit-neutron-gateway-0[22632]: 2016-01-28 18:50:56 INFO unit.neutron-gateway/0.install logger.go:40 dns.resolver.NXDOMAIN
unit-cinder-volume-0[22570]: 2016-01-28 18:52:39 INFO unit.cinder-volume/0.install logger.go:40     raise NXDOMAIN
unit-cinder-volume-0[22570]: 2016-01-28 18:52:39 INFO unit.cinder-volume/0.install logger.go:40 dns.resolver.NXDOMAIN

By the way: why exactly is this just an INFO message when it's an
unhandled exception that, according to the comment, "kills the hook"?

All nodes have an /etc/hosts file that makes them mutually resolvable by
gethostbyname(), but they use 8.8.8.8 and 8.8.4.4 for their DNS servers,
which means they obviously can't resolve each other's host names via
DNS.

-- 
You received this bug notification because you are a member of Ubuntu
OpenStack, which is subscribed to cinder in Juju Charms Collection.
Matching subscriptions: charm-bugs
https://bugs.launchpad.net/bugs/1538812

Title:
  Relies on DNS to resolve own hostname

Status in ceph package in Juju Charms Collection:
  New
Status in cinder package in Juju Charms Collection:
  New
Status in nova-compute package in Juju Charms Collection:
  New

Bug description:
  In charm/hooks/utils.py, the get_host_ip method seems to rely on DNS
  to resolve host names:

  @cached
  def get_host_ip(hostname=None):
      if config('prefer-ipv6'):
          return get_ipv6_addr()[0]

      hostname = hostname or unit_get('private-address')
      try:
          # Test to see if already an IPv4 address
          socket.inet_aton(hostname)
          return hostname
      except socket.error:
          # This may throw an NXDOMAIN exception; in which case
          # things are badly broken so just let it kill the hook
          answers = dns.resolver.query(hostname, 'A')
          if answers:
              return answers[0].address

  Firstly, the dns.resolver.query call strikes me as incredibly silly.
  What if the other node in not resolvable via DNS, but its name is in
  /etc/hosts? What if the other node *is* in DNS, but is a CNAME? And,
  bottom line, why not simply use socket.gethostbyname() here?

  Secondly, this currently (as of today) breaks a Ceph deployment. It
  definitely didn't do so a month ago, so whatever it was that changed
  in the interim, this is a regression. I don't know if this code path
  wasn't there earlier, or whether it was just never hit. But it
  definitely used to work, and no longer does.

To manage notifications about this bug go to:
https://bugs.launchpad.net/charms/+source/ceph/+bug/1538812/+subscriptions



More information about the Ubuntu-openstack-bugs mailing list