summaryrefslogtreecommitdiffstats
path: root/openstack/common/eventlet_backdoor.py
diff options
context:
space:
mode:
authorMatthew Treinish <treinish@linux.vnet.ibm.com>2012-11-14 10:21:18 -0500
committerMatthew Treinish <treinish@linux.vnet.ibm.com>2012-11-14 10:49:13 -0500
commitd16c1e9a35aa84892bcecd91893f4d4912bf0b0a (patch)
treebd3de28dd031ad6c838c290d24690c6891d75601 /openstack/common/eventlet_backdoor.py
parent33fbd87975aec414cfe5c9eaa8435ddae076f91f (diff)
downloadoslo-d16c1e9a35aa84892bcecd91893f4d4912bf0b0a.tar.gz
oslo-d16c1e9a35aa84892bcecd91893f4d4912bf0b0a.tar.xz
oslo-d16c1e9a35aa84892bcecd91893f4d4912bf0b0a.zip
Enable eventlet_backdoor to return port.
Instead of having no return initialize_if_enabled() will now return the port being used for the backdoor. This will allow the use of random ports (which is set with a backdoor_port configuration option set to 0) This will also enable nova to be able to switch to using the version of eventlet_backdoor here instead of the copy in nova.common which will require this change in nova. Change-Id: I01b6966daba410d82281ba86b5d295313ec36c68
Diffstat (limited to 'openstack/common/eventlet_backdoor.py')
-rw-r--r--openstack/common/eventlet_backdoor.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/openstack/common/eventlet_backdoor.py b/openstack/common/eventlet_backdoor.py
index 242c371..b28a2c6 100644
--- a/openstack/common/eventlet_backdoor.py
+++ b/openstack/common/eventlet_backdoor.py
@@ -61,7 +61,7 @@ def initialize_if_enabled():
}
if CONF.backdoor_port is None:
- return
+ return None
# NOTE(johannes): The standard sys.displayhook will print the value of
# the last expression and set it to __builtin__._, which overwrites
@@ -73,6 +73,8 @@ def initialize_if_enabled():
pprint.pprint(val)
sys.displayhook = displayhook
- eventlet.spawn_n(eventlet.backdoor.backdoor_server,
- eventlet.listen(('localhost', CONF.backdoor_port)),
+ sock = eventlet.listen(('localhost', CONF.backdoor_port))
+ port = sock.getsockname()[1]
+ eventlet.spawn_n(eventlet.backdoor.backdoor_server, sock,
locals=backdoor_locals)
+ return port