From 00bc1592e117d5f037f0c214c75b01f9d64f262b Mon Sep 17 00:00:00 2001 From: Satoshi Kobayashi Date: Tue, 27 Jan 2015 14:54:05 +0900 Subject: [PATCH] ryu-manager: add --enable-debugger option Eventlet's monkey patch overwrite Python standard threading library by default. It affects to Python debugger working. This will be often an issue for the user of Python debugger. Therefore, it's necessary to add the option which doesn't overwrite Python standard threading library. Signed-off-by: Satoshi Kobayashi Signed-off-by: FUJITA Tomonori --- ryu/cmd/manager.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/ryu/cmd/manager.py b/ryu/cmd/manager.py index cdcc7ae9..66d59b3b 100755 --- a/ryu/cmd/manager.py +++ b/ryu/cmd/manager.py @@ -17,7 +17,7 @@ # limitations under the License. from ryu.lib import hub -hub.patch() +hub.patch(thread=False) # TODO: # Right now, we have our own patched copy of ovs python bindings @@ -50,6 +50,9 @@ CONF.register_cli_opts([ cfg.MultiStrOpt('app', positional=True, default=[], help='application module name to run'), cfg.StrOpt('pid-file', default=None, help='pid file name'), + cfg.BoolOpt('enable-debugger', default=False, + help='don\'t overwrite Python standard threading library' + '(use only for debugging)'), ]) @@ -64,6 +67,13 @@ def main(args=None, prog=None): log.init_log() + if CONF.enable_debugger: + LOG = logging.getLogger('ryu.cmd.manager') + msg = 'debugging is available (--enable-debugger option is turned on)' + LOG.info(msg) + else: + hub.patch(thread=True) + if CONF.pid_file: import os with open(CONF.pid_file, 'w') as pid_file: