当前位置: 代码迷 >> 综合 >> Fedora 16上源码建立pydev + eclipse的OpenStack开发环境笔记草稿 ( by quqi99 )
  详细解决方案

Fedora 16上源码建立pydev + eclipse的OpenStack开发环境笔记草稿 ( by quqi99 )

热度:16   发布时间:2023-12-13 09:47:59.0


                                                                 Fedora 16上源码建立pydev + eclipse的OpenStack开发环境笔记草稿  ( by quqi99 )


作者:张华  发表于:2012-3-30
版权声明:可以任意转载,转载时请务必以超链接形式标明文章原始出处和作者信息及本版权声明

( http://blog.csdn.net/quqi99 )

        

1网络桥接配置

首先,fedora16对网卡使用了新的命名方式,第一块网卡不叫eth0,我的T420上叫em1。它为什么做,有兴趣可参考文献:

Fedora15的新的网卡命名方式http://www.20ju.com/content/V168885.htm

总之,我不喜欢这种叫法,现在将网卡名称从em1改回eth0,具体做法请参考文献,(修改fedora16的网络接口名,使其变回eth0http://www.bitbi.biz/fedora-2/%E4%BF%AE%E6%94%B9fedora-16-%E7%9A%84%E7%BD%91%E7%BB%9C%E6%8E%A5%E5%8F%A3%E5%90%8D%EF%BC%8C%E4%BD%BF%E5%85%B6%E5%8F%98%E5%9B%9E-eth0-2685

最后配置桥接(参考文献:http://blog.bodhizazen.net/linux/fedora-15-virt-manager-bridged-networking/):


sudoyuminstallbridge-utils

sudovi/etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE=eth0

TYPE=Ethernet

#changethehardwareaddresstomatchthehardwareaddressyourNICuses

HWADDR=00:21:CC:60:D6:1A

ONBOOT=yes

#BOOTPROTO=dhcp

#MODE=Managed

BRIDGE=br100

NM_CONTROLLED=no


sudovi/etc/sysconfig/network-scripts/ifcfg-br100

DEVICE=br100


TYPE=Bridge

BOOTPROTO=dhcp

#BOOTPROTO=static

#IPADDR=192.168.99.100

#NETWORK=192.168.99.0

#NETMASK=255.255.255.0

#GATEWAY=192.168.99.1

#DNS1=202.106.195.30

ONBOOT=yes

NM_CONTROLLED=no


最后重启网络服务,sudoservicenetworkrestart需要注意的是,fedora默认使用NetworkManager来管理网卡,而briage不支持NetworkManager,所以需要关闭NetworkManager服务(sudoserviceNetworkManagerstop&sudoserviceNetworkManager disable)。不然会报下列错(tail-f/var/log/message)

http://forums.fedoraforum.org/showthread.php?t=262356

Bringingupinterfaceeth0:Error:Connectionactivationfailed:DevicenotmanagedbyNetworkManagerorunavailable
[FAILED]
RTNETLINK
answers:Fileexists

不过,我没有使用上述方法,因为你关闭NetworkManager服务的话,你的无线网卡也不能用NetworkManager管理了,所以我在上述的配置中加了NM_CONTROLLED=no实现了同样的目的。

我机器的其他条件是:

1)你得确保安装了libvirtd(yuminstalllibvirtd&servicelibvirtdstart),可用virsh-cqemu:///systemlist命令测试

2)安装gcc,这个在安装pythonmodules时会用到

3mysqlroot用户应该有密码,可用echo"showdatabases"|mysql-uroot-ppassword

4)在命令行中先切换到root用户,然后再启动eclipse

2通过git下载源码

1) 安装javaeclipse,略

2)为eclipse安装pydev插件(help->installnewsoftwae...,http://pydev.org/updates),然后再"window->preferences":菜单中的Pydev->InterpreterPython选项卡中点击AutoConfig按钮配置python

3) eclipse安装egit插件(http://download.eclipse.org/egit/updates)

4)eclipse安装django插件:

installdjangopluginforpython,firstdownloadhttp://www.djangoproject.com/download/1.3.1/tarball/

sudopythonsetup.pyinstallexportPATH=/usr/lib/python2.7/site-packages/django/bin:$PATH

django-admin.pyversion

django-admin.pystartprojectmyFirstDjango

cdmyFirstDjango

sudochmod777*

./manage.pyrunserver

http://127.0.0.1:8000/

5)eclipse中通过git插件clone下列组件的master分支(cloneagitrepository),注意,有的组件会下载失败,只需要将https协议换成git协议即可。我的代码下载在/bak/openstack目录下。

#computeservice

NOVA_REPO=https://github.com/openstack/nova.git

#storageservice

SWIFT_REPO=https://github.com/openstack/swift.git

#imagecatalogservice

GLANCE_REPO=https://github.com/openstack/glance.git

#unifiedauthsystem(managesaccounts/tokens)

KEYSTONE_REPO=https://github.com/openstack/keystone.git

#awebsockets/html5orflashpoweredVNCconsoleforvminstances

NOVNC_REPO=https://github.com/cloudbuilders/noVNC.git

#djangopoweredwebcontrolpanelforopenstack

HORIZON_REPO=https://github.com/openstack/horizon.git

#pythonclientlibrarytonovathathorizon(andothers)use

NOVACLIENT_REPO=https://github.com/openstack/python-novaclient.git

#pythonkeystoneclientlibrarytonovathathorizonuses

KEYSTONECLIENT_REPO=https://github.com/openstack/python-keystoneclient

#quantumservice

QUANTUM_REPO=https://github.com/openstack/quantum

#quantumclient

QUANTUM=https://github.com/openstack/python-quantumclient

#Tempesttestsuite

https://github.com/openstack/tempest.git

#melangeservice

https://github.com/openstack/melange.git

#pythonmelangeclientlibrary

https://github.com/openstack/python-melangeclient.git

#swiftclient

https://github.com/chmouel/python-swiftclient.git

3eclipse中导入工程

1)"GitRepositories"视图上上步clone下来的每一个工程的"WorkingDirector"目录上右键点击选"importprojects"导入工程,再选importasgeneralproject",直接见下图吧。

2)依次做完上步之后,然后可以进入java视图,在每个工程上点右键选"Pydev->setasPydevproject",即使是horizon工程也不例外,设置的是pydevproject,而不是django工程

3安装一些依赖包

  1. install python-pip,nowpipisareplacementfor`easy_install`

sudo yumsearchpython-pip

sudo yuminstallpython-pip.noarch

sudo yuminfopython-pip.noarch

  1. sudo yuminstallgcc;

sudo yuminstallpython-devel

sudo yuminstallpython-greenlet

sudo yuminstallMySQL-python

sudo yuminstalleuca2ools

sudo yuminstalldnsmasq

sudo yuminstallscsi-target-utils

  1. install MQ

rabbitmqconfiguration

sudoyuminstallrabbitmq-server

sudoservicerabbitmq-serverstart

sudochkconfigrabbitmq-serveron

changetherabbitpasswordsincethedefaultis"guest"

sudorabbitmqctlchange_passwordguestpassword

sudorabbitmqctlstatus

  1. install mysql

sudoyuminstallmysql-serverphp-mysql

sudoservicemysqldstart

sudochkconfigmysqldon

mysql-uroot-ppasswordSETPASSWORDFOR'root'@'localhost'=PASSWORD('password');

sudomysql-uroot-ppassword-h127.0.0.1-e"GRANTALLPRIVILEGESON*.*TO'root'@'%'identifiedby'password';"

sudocp/usr/share/mysql/my-small.cnf/etc/my.cnf

sudosed-i's/127.0.0.1/0.0.0.0/g'/etc/my.cnf

  1. install libvirt

sudo yuminstalllibvirt

sudo servicelibvirtdrestart

6) sudoyuminstallpython-sqlite2python-lxmlpython-greenlet-develpython-ldap

4 安装依赖的Pythonmodules

依次检查,如果有的工程下的目录有tools/pip-requires,则可以运行下列命令安装依赖的pythonmodules,例:

cd/bak/openstack/python-novaclient/

pip-python install-rtools/pip-requires

pip-python install-rtools/test-requires

并对除了你要在eclipse中运行的工程(keystone,glance,nova,horion)除外的其他工程(novaclient,keystoneclient)依次运行命令:

python setup.py develop

注意,如果在对nova运行时报ImportError:cannotimportnamenormalizenormalize/usr/lib64/python2.7/local.py里的一个方法,原因是nova工程的目录下有一个locale的目录将local的名称空间给盖了(http://groups.google.com/group/django-users/browse_thread/thread/e8bb9089d9e5be60)

5最小化配置openstack

只需要启动keystone,glance-reg,glance-api,nova-all,dashboard四个组件就可以启动openstack了,其他的服务不是必须的。其中,由于dashboard是一个django工程,我们不需要安装apache,用django自带的http服务器(pythonmanage.pyrunserver)即可启动它。

5.1配置keystone

1)配置:

vi/bak/openstack/keystone/etc/keystone.conf

connection=mysql://root:password@localhost/keystone

driver=keystone.token.backends.sql.Token

driver=keystone.contrib.ec2.backends.sql.Ec2

2)创建数据库:

mysql-uroot-ppassword-e'dropdatabasekeystone'

mysql-uroot-ppassword-e'createdatabasekeystone'

mysql-uroot-ppassword-e"grantallon*.*toroot@'%'identifiedby'password'"

cd/bak/openstack/keystone&&./bin/keystone-managedb_sync

3)启动

若是在命令行中如下方法启动

./bin/keystone-all--config-file /bak/openstack/keystone/etc/keystone.conf --log-config/bak/openstack/keystone/etc/logging.conf -d –debug

若是在eclipse中,如下图,一定要将Argumentsworkingdirctory中的${workspace_loc:keystone/bin}改为{workspace_loc:keystone},如果你不想这样改的话,那就你就得在Programarguments那段填参数--config-file/bak/openstack/keystone/etc/keystone.conf --log-config/bak/openstack/keystone/etc/logging.conf -d –debug












    1. 初始化数据

SERVICE_TOKEN=ADMIN
ADMIN_PASSWORD=password
SERVICE_ENDPOINT=http://localhost:35357/v2.0
export
SERVICE_TOKEN=$SERVICE_TOKEN
export
SERVICE_ENDPOINT=$SERVICE_ENDPOINT
function
get_id(){
echo`$@|grepid|awk'{print$4}'`
}
ADMIN_TENANT=`get_id
keystonetenant-create--name=admin`
ADMIN_USER=`get_id
keystoneuser-create--name=admin--pass="$ADMIN_PASSWORD"--email=admin@example.com`
ADMIN_ROLE=`get_id
keystonerole-create--name=admin`
KEYSTONEADMIN_ROLE=`get_id
keystonerole-create--name=KeystoneAdmin`
KEYSTONESERVICE_ROLE=`get_id
keystonerole-create--name=KeystoneServiceAdmin`
keystone
user-role-add--user$ADMIN_USER--role$ADMIN_ROLE--tenant_id$ADMIN_TENANT
keystone
user-role-add--user$ADMIN_USER--role$KEYSTONEADMIN_ROLE--tenant_id$ADMIN_TENANT
keystone
user-role-add--user$ADMIN_USER--role$KEYSTONESERVICE_ROLE--tenant_id$ADMIN_TENANT

echo$?

5)验证

keystoneservice-list

keystoneuser-list

keystonerole-list

  1. 架构http://keystone.openstack.org/architecture.html

Service,使用keystone的内部服务

Identity,基于角色的验证与授权

Token,user/tenantcredentials已经验证之后生成的随机数

Catalog,注册的后端,sql,kvs,ldap

Policy,提供rule-basedauthorizationengine

nosetests-s-vtest_backend_sql.py


keystoneservice-create--nameCOMPUTE_ID--typecompute--description'OpenStackComputeservice'




keystoneendpoint-create--region=RegionOne--service_id=COMPUTE_ID--publicurl='http://localhost:$(compute_port)s/v1.1/$(tenant_id)s'--internalurl='http://localhost:$(compute_port)s/v1.1/$(tenant_id)s'adminurl='http://localhost:$(compute_port)s/v1.1/$(tenant_id)s'


keystoneendpoint-create--region=RegionOne--service_id=IDENTITY_ID--publicurl='http://localhost:$(public_port)s/v2.0'--internalurl='http://localhost:$(public_port)s/v2.0'--adminurl='http://localhost:$(admin_port)s/v2.0'




keystoneendpoint-create--region=RegionOne--service_id=IMAGE_ID--publicurl='http://localhost:9292/v1'--internalurl='http://localhost:9292/v1'--adminurl='http://localhost:9292/v1'

执行上述语句要keystone.conf文件中有:

driver= keystone.catalog.backends.sql.Catalog


5.2配置glance

1)配置

vi/bak/openstack/glance/etc/glance-registry.conf

sql_connection=mysql://root:password@localhost/glance


vi/bak/openstack/glance/etc/glance-api-paste.conf

vi/bak/openstack/glance/etc/glance-registry-paste.conf

#admin_tenant_name=%SERVICE_TENANT_NAME%

#admin_user=%SERVICE_USER%

#admin_password=%SERVICE_PASSWORD%

admin_token=ADMIN


vi/bak/openstack/glance/etc/glance-api.conf

vi/bak/openstack/glance/etc/glance-registry.conf

[paste_deploy]

flavor=keystone

debug=True

#log_file=/var/log/glance/api.log


2)数据库:

mysql-uroot-ppassword-e'DROPDATABASEIFEXISTSglance;'

mysql-uroot-ppassword-e'CREATEDATABASEglance;'

mysql-uroot-ppassword-e"grantallon*.*toroot@'%'identifiedby'password'"

cd/bak/openstack/glance&&./bin/glance-managedb_sync

3)启动

./bin/glance-registry--config-file=/bak/openstack/glance/etc/glance-registry.conf

filesystem_store_datadir=/var/lib/glance/images

./bin/glance-apiconfig-file=/bak/openstack/glance/etc/glance-api.conf

如果是在eclipse中启动,注意和上面keystone的一样,将基准路径从${workspace_loc:glance/bin}改为${workspace_loc:glance},这样改了之后,就直接从${workspace_loc:glance/}/etc/glance目录读配置文件,而不是从/etc/glance


4) 上传镜像

cd /bak/openstack/glance

export FILES=/bak/openstack/glance

mkdir -p $FILES/images


exportOS_AUTH_USER=admin
export OS_AUTH_KEY=password
exportOS_AUTH_TENANT=admin
exportOS_AUTH_URL=http://localhost:35357/v2.0
exportOS_AUTH_STRATEGY=keystone
sudo wget -chttp://images.ansolabs.com/tty.tgz -O $FILES/images/tty.tgz
tar-zxf $FILES/images/tty.tgz -C $FILES/images
TOKEN=`curl -s -d"{\"auth\":{\"passwordCredentials\":{\"username\": \"$OS_AUTH_USER\", \"password\":\"$OS_AUTH_KEY\"}, \"tenantName\":\"$OS_AUTH_TENANT\"}}" -H "Content-type:application/json" http://localhost:5000/v2.0/tokens | python -c"import sys; import json; tok = json.loads(sys.stdin.read());print tok['access']['token']['id'];"`

RVAL=`./bin/glanceadd -A $TOKEN name="cirros-kernel" is_public=truecontainer_format=aki disk_format=aki <$FILES/images/aki-tty/image`
KERNEL_ID=`echo $RVAL | cut -d":"-f2 | tr -d " "`


RVAL=`./bin/glance add-A $TOKEN name="cirros-ramdisk" is_public=truecontainer_format=ari disk_format=ari<$FILES/images/ari-tty/image`
RAMDISK_ID=`echo $RVAL | cut-d":" -f2 | tr -d " "`


./bin/glance add -A$TOKEN name="cirros" is_public=true container_format=amidisk_format=ami kernel_id=$KERNEL_ID ramdisk_id=$RAMDISK_ID<$FILES/images/ami-tty/image

5) 验证
./bin/glance-f index

5.4nova配置

sudoyuminstallscsi-target-utils

sudoservicetgtdrestart(如果启动不了,可换用于fedora17tgtdrpm包)

sudosystemctlstatustgtd.service

sudovgsnova-volumes

sudolosetup-f--show/bak/kvmimages/nova.img

sudovgcreatenova-volumes/dev/loop0

sudoservicetgtdrestart

sudosystemctlstatustgtd.service

sudosystemctlstatusnetwork.service

实例路径:/bak/openstack/nova/instances

查看实例:virshlist--all

查看iscsisession:iscsiadm--modenode

删除iscsisession:sudoiscsiadm--modenode--logout&&sudoiscsiadm--modenode--opdelete


1)配置文件

vi/etc/nova/nova.conf

--verbose

--logdir=/var/log/nova
--state_path=/var/lib/nova
--lock_path=/var/lib/nova/tmp
--instances_path=/var/lib/nova/instances
--debug=True

--scheduler_driver=nova.scheduler.simple.SimpleScheduler

--dhcpbridge_flagfile=/etc/nova/nova.conf

--fixed_range=10.0.0.0/24

--s3_host=127.0.0.1

--network_manager=nova.network.manager.FlatDHCPManager

--volume_group=nova-volumes

--volume_name_template=volume-%08x

--iscsi_helper=tgtadm

--osapi_compute_extension=nova.api.openstack.compute.contrib.standard_extensions

--my_ip=localhost

--public_interface=br100

--vlan_interface=eth0

--sql_connection=mysql://root:password@localhost/nova

--libvirt_type=kvm

--instance_name_template=instance-%08x

--novncproxy_base_url=http://127.0.0.1:6080/vnc_auto.html

--xvpvncproxy_base_url=http://127.0.0.1:6081/console

--vncserver_listen=127.0.0.1

--vncserver_proxyclient_address=127.0.0.1

--api_paste_config=/etc/nova/api-paste.ini

--image_service=nova.image.glance.GlanceImageService

--ec2_dmz_host=127.0.0.1

--rabbit_host=localhost

--rabbit_password=password

--glance_api_servers=127.0.0.1:9292

--force_dhcp_release

--connection_type=libvirt

--firewall_driver=nova.virt.libvirt.firewall.IptablesFirewallDriver


--flat_network_bridge=br100

--flat_interface=eth0

--auth_strategy=keystone


cp/bak/openstack/nova/etc/nova/api-paste.ini/etc/nova/

vi/bak/openstack/nova/etc/nova/api-paste.ini

#admin_tenant_name=%SERVICE_TENANT_NAME%

#admin_user=%SERVICE_USER%

#admin_password=%SERVICE_PASSWORD%

admin_token=ADMIN



2)数据库

mysql-uroot-ppassword-e'DROPDATABASEIFEXISTSnova;'

mysql-uroot-ppassword-e'CREATEDATABASEnova;'

cd/bak/openstack/nova&&sudo./bin/nova-managedbsync

3)fixthepydevproblemwith"eventlet.monkey_patch()"

cd/bak/openstack/nova/bin

perl-pi-e's/eventlet\.monkey_patch\(\)/eventlet\.monkey_patch\(all=False,socket=True,select=True\)/g'*


4千万不要将glance安装到系统中,但要在eclipse中设置glancekeystonenove的工程依赖,如果已安装,可按下列方法清除。

pip-pythonuninstallglance

rm-rf/usr/bin/glance*

rm-rf/usr/lib/python2.7/site-packages/glance.egg-link

5)启动

vi/bak/openstack/nova/bin/nova-all

#forbinaryin['nova-compute','nova-network','nova-scheduler','nova-cert']:

forbinaryin['nova-compute','nova-network','nova-scheduler']:


启动:/bak/openstack/nova/bin/nova-all

5)验证

#forkeystoneclient

exportSERVICE_ENDPOINT=http://localhost:35357/v2.0
export
SERVICE_TOKEN=ADMIN

#for
novaclient
export
NOVA_AUTH_STRATEGY=keystone
export
NOVA_USERNAME=admin
export
NOVA_PASSWORD=password
export
NOVA_PROJECT_ID=admin
export
NOVA_URL=http://localhost:35357/v2.0
export
NOVA_VERSION=1.1

#for glanceclient

export OS_AUTH_USER=admin
exportOS_AUTH_KEY=password
export OS_AUTH_TENANT=admin
exportOS_AUTH_URL=http://localhost:35357/v2.0
exportOS_AUTH_STRATEGY=keystone



nova list

nova flavor-list

nova image-list

novadebugboot--flavorm1.tiny--image5213ac41-a588-419f-9b50-c86217433df9quqitestserver

nova-manageservicelist

若网络服务启动失败,可能要:rm-rf/var/lib/nova/tmp/nova-iptables.lock

如果上述命令不能执行,有可能是因为它无法找到policy.json文件,需要将eclipse的基准主路设为${workspace_loc:nova/etc/nova}

5.3配置dashboard

mv /bak/openstack/horizon/openstack_dashboard/local /bak/openstack/horizon/openstack_dashboard/local/local_settings.py

vi/bak/openstack/horizon/openstack_dashboard/local/local_settings.py

DATABASES= {

'default':{

'ENGINE':'django.db.backends.mysql',

'NAME':'dash',

'USER':'root',

'PASSWORD':'password',

'HOST':'localhost',

'default-character-set':'utf8',

},

}


vi/bak/openstack/horizon/manage.py

#!/usr/bin/envpython

fromdjango.core.management import execute_manager

importos, sys

ROOT_PATH= os.path.dirname(os.path.abspath(__file__))

ifROOT_PATH not in sys.path:

sys.path.insert(0,ROOT_PATH)

importopenstack_dashboard.settings

if__name__ == "__main__":

execute_manager(openstack_dashboard.settings)



1)创建dashboard数据库

sudomysql-uroot-ppassword-e'createdatabasedash';

sudomysql-uroot-ppassword-e"grantallon*.*toroot@'%'identifiedby'password'"

setPYTHONPATH=/bak/openstack/glance:/bak/openstack/keystone

cd/bak/openstack/horizon/

pythonmanage.pysyncdb


  1. 配置它工程依赖glance,keystone

  2. 将它自身的顶级目录openstack_dashboard加入到PYTHONPATH

  3. 启动,cd/bak/openstack/horizon

pythonmanage.py runserver ,用它启动horion时,就可以不需要启动apache


2012-04.05添加:

上述配置是可以正常启动实例的,但是实例没有IP,那是因为忘了建立虚拟网络,命令如下:

nova-manage network createpublic10.10.10.0/24 1 256

其他测试用到的命令如下: 删除虚拟网络:nova-managenetworkdelete 10.10.10.0/24

启动实例:nova boot --image 5213ac41-a588-419f-9b50-c86217433df9--flavor1 --nic net-id=99b1d65e-34ae-4658-8387-ce9724 myserver8

删除实例:novadelete myserver8

给实例加硬盘:nova volume-create--display_namevolhua11(1代表1G)

删除硬盘:novavolume-attach myserver8 2 /dev/vdb


另外,测试了一下分布式部署,基本上和上面是一样的,注意以下几点就行了:

1)之前单机部署时控制节点的/etc/nova/nova.conf中使用的localhost可以不用动。因为本来mysql, activemq, glance都是安装在控制节点上。

2)但是控制节点 glance/etc/default_catalog.tempates中的IP需要从localhost变为实际IP

3)在计算节点上的/etc/nova/nova.conf中的IP相应改对,如mysql, activemq, glance的IP

4)计算节点仅仅只需要启动一个nova-compute即可工作。但是nova-compute运行时需要通过nova-client, keystone-client, glance-client去调用相应的服务。但是glance为client弄一个工程,所以在计算节点也得像上文中的方法安装nova-client, keystone-client, glance三个依赖工程


另外,如果在eclipse中无法调试nova工程的话,那是因为nova中使用了一个叫做eventlet的python协程库(大家知道的nginx是java里的一个非阻塞I/O库),所谓协程,是一个比线程更小的单位,协程运行在用户空间,所以操作系统无法感知它,所以它需要程序员自己去调度协程,这样用于执行协作式多任务效率比只用线程的更高。eventlet中有一个叫monkey patch的东东,它用来在运行时对己有的代码进行修改,达到hot patch的目的。eventlet使用该技巧用来替换一些python的标准的库,比如说socket。就是因为这个东东把一些标准库给替换成它自己的库然后与pydev插件冲突,所以造成无法在eclipse中调试程序。比如说现在想调试bin/nova-network,那样可以修改bin/nova-network脚本,将evenlet.monkye_patch()替换成:

eventlet.monkey_patch(all=False,socket=True,select=True)


如果想要调试nova-api里的子进程呢?看下列方法。

 1.
avoid eventlet blindly greening everything (I suspect the monkey patch would make the debugger not able to block the thread execution.)
 
change eventlet.monkey_patch(os=False) to eventlet.monkey_patch(all=False,socket=True,select=True) in nova/bin/nova-api
 
 
2.
make sure pydevd.py module is included in your python path
 
e.g. PYTHONPATH=/usr/share/eclipse/dropins/pydev/eclipse/plugins/org.python.pydev_2.6
 
 
3.
insert
        import pydevd;
        pydevd.settrace()
 
to where you want to start debugging
 
 
4.
start debug server, and switch to debug perspective
 
in eclipse, click on Pydev menu and select start debug server on the pull down list
 
 
5.
run the remote program
 
i.e. nova/bin/nova-api for nova API
 
the program should be associated to the debug server now

 

Note: The reason why we cannot simply right click on nova-api and go Debug As --> Python Run in eclipse is that this will attach the debugger to the parent process which does nothing other than forking off child workers and waiting on them to exit


  相关解决方案