eclipse+pydev調試openstack
1.為了調試openstack,另外安裝一個eclipse。
2.在eclipse上安裝pydev外掛程式:
window->preferences->general->networkconnect
activeprovider:manual
editproxy entry:schema:http,host:127.0.0.1,port:8123,
help->installnew software->work with:pydev - http://pydev.org/updates
選擇跟系統中python版本相對應的pydev版本
取消“show only the latestversions of available software”
next->finish
3.(將虛擬機器裡搭建好的openstack源碼拷貝到本地eclipse的workspace工程中“my_openstack”)
file->new->pydevproject->project name :my_openstack
取消“use default”
選擇目錄“/root/workspace/my_openstack”
grammarversion:對應python版本
iterpreter:python
"addproject directory to the PYTHONPATH"
finish
4.拷貝eclipse\plugins\org.python.pydev_x.x.x\pysrc目錄到虛擬機器中“/home/pysrc”
5.修改虛擬機器的pysrc中pydev_file_utils.py:
PATHS_FROM_ECLIPSE_TO_PYTHON=[(r'/root/soft/eclipse_jck/plugins/org.python.pydev_2.6.0.2012062818/pysrc/',r'/home/panfy/pysrc/'),(r'/root/workspace/pydev_openstack/',r'/usr/lib/python2.7/site-packages/')]
DEBUG_CLIENT_SERVER_TRANSLATION= True
6.修改虛擬機器的openstack代碼:
例:要調試ceilometerclient.
修改ceilometerclient中的shell.py
importsys
sys.path.append('/home/pysrc')
添加import pydevd;pydevd.settrace('10.167.225.103')IP地址是本地主機的地址
到要調試處的開頭
7.在eclipse中:
*debug->啟動調試服務:pydev:start the pydevserver
有“debug server at port:5678”提示
8.在虛擬機器中執行相應的命令,觸發調試