zoukankan      html  css  js  c++  java
  • How to remote debug neutron

    First of all, I will assume that you know how to use pydevd to remote debug normal python program. If you do not know that, you can read the corresponding docs on Pycharm official website.

    If you know very well how to remote debug normal python programs and you are trying to remote debug neutron, you can continue.

    To remote debug neutron, only three additional things need to be done:

    1. Change the worker numbers of neutron api server.

    You need to edit /etc/neutron/neutron.conf to set api_worker = -1. Because by default, neutron will start multi-workers.

    2. Config your IDE (my case it is PyCharm).

    In Pycharm you need to set

    File->Build, Extension, Debugger->Python Debuger->Gevent Compatible
    

    3. In neutron code, You need to edit neutron/common/eventlet_utils.py

    On the server, the absolute path will be the neutron install location. Like /usr/lib/python2.7/site-packages/neutron/common/eventlet_utils.py

    Change the

    eventlet.monkey_patch
    

    to

    eventlet.monkey_patch(os=False, thread=False)
    

    The reason to do this is very well explained in the code comment

    import os
    
    import eventlet
    
    
    def monkey_patch():
    	if os.name == 'nt':
    		# eventlet monkey patching the os and thread modules causes
    		# subprocess.Popen to fail on Windows when using pipes due
    		# to missing non-blocking IO support.
    		#
    		# bug report on eventlet:
    		# https://bitbucket.org/eventlet/eventlet/issue/132/
    		#       eventletmonkey_patch-breaks
    		eventlet.monkey_patch(os=False, thread=False)
    	else:
    		eventlet.monkey_patch(os=False, thread=False)
    

    OK now. You can remote debug as you did.

  • 相关阅读:
    java 深克隆(深拷贝)与浅克隆(拷贝)详解
    设计模式之单例模式
    设计模式之工厂模式
    批量下载google 字体小工具
    LBPL--基于Asp.net、 quartz.net 快速开发定时服务的插件化项目
    测试
    WCF 生产json对外的接口
    四舍五入小算法 (以前写的,采用拆分)
    自己动手写控件(模仿mvc htmlhelper的类)
    步骤详解安装Apache web服务器
  • 原文地址:https://www.cnblogs.com/kramer/p/5660442.html
Copyright © 2011-2022 走看看