From c9d212a1083dcace36c6c7b0e2bbd6ad4274b0eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A1draig=20Brady?= Date: Thu, 10 Oct 2013 13:09:35 +0100 Subject: report port number for address already in use errors * nova/wsgi.py(Service.__init__): Catch external errors (socket.error is a subclass of EnvironmentError since python 2.6), and log the port number attempted to bind to. Closes-Bug: 1237961 Change-Id: Ia4eb46c76db855fc3168c5b7a233ce94d2ef7726 --- nova/wsgi.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'nova/wsgi.py') diff --git a/nova/wsgi.py b/nova/wsgi.py index c181c29c72..f4d9551ddf 100644 --- a/nova/wsgi.py +++ b/nova/wsgi.py @@ -121,7 +121,13 @@ class Server(object): except Exception: family = socket.AF_INET - self._socket = eventlet.listen(bind_addr, family, backlog=backlog) + try: + self._socket = eventlet.listen(bind_addr, family, backlog=backlog) + except EnvironmentError: + LOG.error(_("Could not bind to %(host)s:%(port)s"), + {'host': host, 'port': port}) + raise + (self.host, self.port) = self._socket.getsockname()[0:2] LOG.info(_("%(name)s listening on %(host)s:%(port)s") % self.__dict__) -- cgit v1.2.1