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 <satoshi-k@stratosphere.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
This commit is contained in:
Satoshi Kobayashi 2015-01-27 14:54:05 +09:00 committed by FUJITA Tomonori
parent 578327edc9
commit 00bc1592e1

View File

@ -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: