summaryrefslogtreecommitdiffstats
path: root/openstack/common/wsgi.py
diff options
context:
space:
mode:
authorDavanum Srinivas <dims@linux.vnet.ibm.com>2013-01-16 12:12:04 -0500
committerGerrit Code Review <review@openstack.org>2013-02-03 03:30:11 +0000
commitbd5d9f08ecc3c1fade6dce809ee9edef1c226e54 (patch)
tree83000f296da9bc126c3d4bb3cefc8e6afab3ea62 /openstack/common/wsgi.py
parent6ce830b0e4e8a9c00d3cfb51f643dec3e1286cee (diff)
downloadoslo-bd5d9f08ecc3c1fade6dce809ee9edef1c226e54.tar.gz
oslo-bd5d9f08ecc3c1fade6dce809ee9edef1c226e54.tar.xz
oslo-bd5d9f08ecc3c1fade6dce809ee9edef1c226e54.zip
Support for ipv6 in wsgi.Service
Enable wsgi.Service to listen on ipv6 address by checking if the host specified is ipv6. Based on that set the appropriate family in the eventlet.listen api More tests for just the ipv6, ipv6 with app, ipv6+ssl with app to make sure everything is working fine Change-Id: I2772905128bdbc69dd0fafe4ced848f5c477d7c8
Diffstat (limited to 'openstack/common/wsgi.py')
-rw-r--r--openstack/common/wsgi.py14
1 files changed, 11 insertions, 3 deletions
diff --git a/openstack/common/wsgi.py b/openstack/common/wsgi.py
index 550ea4d..f97d24e 100644
--- a/openstack/common/wsgi.py
+++ b/openstack/common/wsgi.py
@@ -81,15 +81,23 @@ class Service(service.Service):
super(Service, self).__init__(threads)
def _get_socket(self, host, port, backlog):
-
- 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
+ info = socket.getaddrinfo(host,
+ port,
+ socket.AF_UNSPEC,
+ socket.SOCK_STREAM)[0]
+ family = info[0]
+ bind_addr = info[-1]
sock = None
retry_until = time.time() + 30
while not sock and time.time() < retry_until:
try:
sock = eventlet.listen(bind_addr,
- backlog=backlog)
+ backlog=backlog,
+ family=family)
if sslutils.is_enabled():
sock = sslutils.wrap(sock)