From d16c1e9a35aa84892bcecd91893f4d4912bf0b0a Mon Sep 17 00:00:00 2001 From: Matthew Treinish Date: Wed, 14 Nov 2012 10:21:18 -0500 Subject: 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 --- openstack/common/eventlet_backdoor.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'openstack/common/eventlet_backdoor.py') 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 -- cgit