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

James Page james.page at ubuntu.com
Thu Feb 23 18:30:53 UTC 2017

** Changed in: charm-nova-compute
   Importance: Undecided => Medium

** Changed in: charm-nova-compute
       Status: New => Triaged

** Changed in: nova-compute (Juju Charms Collection)
       Status: Triaged => Invalid

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

  Relies on DNS to resolve own hostname

Status in OpenStack ceph charm:
Status in OpenStack cinder charm:
Status in Charm Helpers:
Status in OpenStack nova-compute charm:
Status in ceph package in Juju Charms Collection:
Status in cinder package in Juju Charms Collection:
Status in neutron-gateway package in Juju Charms Collection:
Status in nova-compute package in Juju Charms Collection:

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

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

      hostname = hostname or unit_get('private-address')
          # Test to see if already an IPv4 address
          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:

More information about the Ubuntu-openstack-bugs mailing list