diff options
author | Davanum Srinivas <dims@linux.vnet.ibm.com> | 2013-01-11 10:57:51 -0500 |
---|---|---|
committer | Davanum Srinivas <dims@linux.vnet.ibm.com> | 2013-01-14 15:54:53 -0500 |
commit | 327989ea3a444801769c21009ad7f21daa99290b (patch) | |
tree | ab292aaec4b1d92731a71b2258776827ebc4d9ac | |
parent | b097b59c375c853170954724bbc6bdfff24e08ea (diff) | |
download | nova-327989ea3a444801769c21009ad7f21daa99290b.tar.gz nova-327989ea3a444801769c21009ad7f21daa99290b.tar.xz nova-327989ea3a444801769c21009ad7f21daa99290b.zip |
Fix problem with ipv6 link-local address(es)
Pick up the snippet from glance per markmclain's comment on another review
Change-Id: I6105990fb843a6aadca29b243428bf28510957c7
-rw-r--r-- | nova/wsgi.py | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/nova/wsgi.py b/nova/wsgi.py index c103526da..16851dba8 100644 --- a/nova/wsgi.py +++ b/nova/wsgi.py @@ -83,13 +83,21 @@ class Server(object): raise exception.InvalidInput( reason='The backlog must be more than 1') + bind_addr = (host, port) + # TODO(dims): eventlet's green dns/socket module does not actually + # support IPv6 in getaddrinfo(). We need to get around this in the + # future or monitor upstream for a fix try: - socket.inet_pton(socket.AF_INET6, host) - family = socket.AF_INET6 + info = socket.getaddrinfo(bind_addr[0], + bind_addr[1], + socket.AF_UNSPEC, + socket.SOCK_STREAM)[0] + family = info[0] + bind_addr = info[-1] except Exception: family = socket.AF_INET - self._socket = eventlet.listen((host, port), family, backlog=backlog) + self._socket = eventlet.listen(bind_addr, family, backlog=backlog) (self.host, self.port) = self._socket.getsockname()[0:2] LOG.info(_("%(name)s listening on %(host)s:%(port)s") % self.__dict__) |