devtsack环境准备:
git clone https://github.com/EldonZhao/devstack.git
cd devstack
cp samples/local.conf .
vim local.conf
ADMIN_PASSWORD=123456
DATABASE_PASSWORD=123456
RABBIT_PASSWORD=123456
SERVICE_PASSWORD=$ADMIN_PASSWORD
HOST_IP=192.168.193.128
FORCE=yes ./stack.sh
vim /opt/stack/senlin/senlin/api/openstack/v1/nodes.py
import pdb
pdb.set_trace()
source stack-screenrc
输入Ctrl+a
输入"(双引号)进入进程选择界面
选择代码所在进程,输入回车键enter(如下图)
输入Ctrl+c(结束进程)
输入方向键向上,输入回车键enter
[stack@eldon devstack]$ senlin --debug cluster-list -g
INFO (shell) 1
DEBUG (extension) found extension EntryPoint.parse('v2token = keystoneauth1.loading._plugins.identity.v2:Token')
DEBUG (extension) found extension EntryPoint.parse('admin_token = keystoneauth1.loading._plugins.admin_token:AdminToken')
DEBUG (extension) found extension EntryPoint.parse('v3oidcauthcode = keystoneauth1.loading._plugins.identity.v3:OpenIDConnectAuthorizationCode')
DEBUG (extension) found extension EntryPoint.parse('v2password = keystoneauth1.loading._plugins.identity.v2:Password')
DEBUG (extension) found extension EntryPoint.parse('v3password = keystoneauth1.loading._plugins.identity.v3:Password')
DEBUG (extension) found extension EntryPoint.parse('v3oidcpassword = keystoneauth1.loading._plugins.identity.v3:OpenIDConnectPassword')
DEBUG (extension) found extension EntryPoint.parse('token = keystoneauth1.loading._plugins.identity.generic:Token')
DEBUG (extension) found extension EntryPoint.parse('v3token = keystoneauth1.loading._plugins.identity.v3:Token')
DEBUG (extension) found extension EntryPoint.parse('password = keystoneauth1.loading._plugins.identity.generic:Password')
DEBUG (session) REQ: curl -g -i -X GET http://10.134.29.148:5000/v2.0 -H "Accept: application/json" -H "User-Agent: python-senlinclient"
INFO (connectionpool) Starting new HTTP connection (1): 10.134.29.148
DEBUG (connectionpool) "GET /v2.0 HTTP/1.1" 200 339
DEBUG (session) RESP: [200] Content-Length: 339 Vary: X-Auth-Token Keep-Alive: timeout=5, max=100 Server: Apache/2.4.6 (CentOS) OpenSSL/1.0.1e-fips mod_wsgi/3.4 Python/2.7.5 Connection: Keep-Alive Date: Thu, 25 Feb 2016 12:14:54 GMT Content-Type: application/json x-openstack-request-id: req-52f92c50-a091-46a1-8a45-07f26a5e8c8f
RESP BODY: {"version": {"status": "stable", "updated": "2014-04-17T00:00:00Z", "media-types": [{"base": "application/json", "type": "application/vnd.openstack.identity-v2.0+json"}], "id": "v2.0", "links": [{"href": "http://10.134.29.148:5000/v2.0/", "rel": "self"}, {"href": "http://docs.openstack.org/", "type": "text/html", "rel": "describedby"}]}}
DEBUG (v2) Making authentication request to http://10.134.29.148:5000/v2.0/tokens
DEBUG (connectionpool) "POST /v2.0/tokens HTTP/1.1" 200 4369
DEBUG (session) REQ: curl -g -i -X GET http://10.134.29.148:8778/v1/clusters -H "User-Agent: python-senlinclient" -H "Accept: application/json" -H "X-Auth-Token: {SHA1}dc50206f41d9861fe70c8c3fb7e2cb3d909a3389"
INFO (connectionpool) Starting new HTTP connection (1): 10.134.29.148
b(or break):设置断点;设置函数:b demo.func;设置行数:b demo:14(行数)
n(or next):执行下一行:Step over,跳过
c(or continue):执行下一个断点,没有断点则到程序结束:Step filter
s(or step):进入函数,Step into,单步跳入
r(or return):跳出函数,Step return
l(or list):查看当前代码段
q(or quit):退出当前debug
p(or print):打印变量值
h(or help):查看帮助
cl(clear):清除所有节点
disable [bpnumber[bpnumber]]:将第num个断点失效,enable,失效第10个断点
enable [bpnumber[bpnumber]]:启用第num个断点,enable 10,启用第10个断点
w(where):打印堆栈信息
a(args):打印当前函数参数信息