1, 安装ipdb
easy_install ipdb or pip install ipdb
2, 使用ipdb
net_manager = utils.import_object(FLAGS.network_manager)
import ipdb;ipdb.set_trace() # 打断点,调试
root@roto-virtual-machine:~/nova/api/openstack/compute/contrib# nova-manage network create private --fixed_range_v4=10.14.23.0/24 --num_networks=1 --network_size=32
> /usr/bin/nova-manage(795)create()
794 import ipdb;ipdb.set_trace()
--> 795 net_manager.create_networks(context.get_admin_context(),
796 label=label,
ipdb> help
Documented commands (type help <topic>):
========================================
EOF bt cont enable jump pdef r tbreak w
a c continue exit l pdoc restart u whatis
alias cl d h list pinfo return unalias where
args clear debug help n pp run unt
b commands disable ignore next q s until
break condition down j p quit step up
Miscellaneous help topics:
==========================
exec pdb
Undocumented commands:
======================
retval rv
ipdb>
3, nova-network 使用ipdb
ipdb /usr/bin/python /usr/bin/nova-network --flagfile=/etc/nova/nova.conf