用pdb.set_trace()设断点,跟nova/api/openstack/compute/servers.py - detail() 流程

curl -s -H "X-Auth-Token: $OS_TOKEN" http://192.168.153.128:8774/v2.1/servers/detail | python -m json.tool 命令;

得到结果:

{
"servers": []       注:因为servers是核心资源,所有返回为空。
}

1/opt/stack/nova/nova/api/openstack/compute/servers.py(210)detail() pdb.set_trace()

11/opt/stack/nova/nova/api/openstack/wsgi.py(867)__getattribute__() :
12/opt/stack/nova/nova/api/openstack/compute/servers.py(215)_get_servers() :"""Returns servers, based on search options specified."""
###search_opts.update(req.GET)
121/usr/local/lib/python2.7/dist-packages/webob/request.py(813)GET(): """Return a MultiDict containing all the variables from the QUERY_STRING."""
122/usr/local/lib/python2.7/dist-packages/webob/multidict.py(255)keys():
13/opt/stack/nova/nova/api/openstack/compute/servers.py(1106)_get_server_search_options():"""Return server search options allowed by non-admin."""
14/opt/stack/nova/nova/api/openstack/api_version_request.py(126)is_supported():"""Check if API request version satisfies version restrictions."""
###search_options : (‘reservation_id‘, ‘name‘, ‘status‘, ‘image‘, ‘flavor‘, ‘ip‘, ...)
15/opt/stack/nova/nova/api/openstack/compute/servers.py(1187)remove_invalid_options():"""Remove search options that are not valid for non-admin API/context."""
16/opt/stack/nova/nova/api/openstack/common.py(521)is_all_tenants():"""Checks to see if the all_tenants flag is in search_opts"""
17> /opt/stack/nova/nova/api/openstack/compute/servers.py(332)_get_servers()
-> limit, marker = common.get_limit_and_marker(req):
171/opt/stack/nova/nova/api/openstack/common.py(236)get_limit_and_marker():"""Get limited parameter from request."""
18> /opt/stack/nova/nova/api/openstack/compute/servers.py(333)_get_servers()
-> sort_keys, sort_dirs = common.get_sort_params(req.params):
181> /usr/local/lib/python2.7/dist-packages/webob/request.py(846)params()
182> /opt/stack/nova/nova/api/openstack/common.py(145)get_sort_params()
-> def get_sort_params(input_params, default_key=‘created_at‘,default_dir=‘desc‘):"""Processes the parameters to create a list of sort keys and sort directions that correspond to the ‘sort_key‘ and ‘sort_dir‘ parameter values."""
### return sort_keys, sort_dirs -> ([‘created_at‘], [‘desc‘])

19> /opt/stack/nova/nova/api/openstack/compute/servers.py(337)_get_servers()
-> expected_attrs.append(‘services‘)
20> /opt/stack/nova/nova/api/openstack/compute/servers.py(343)_get_servers()
-> expected_attrs = self._view_builder.get_show_expected_attrs(expected_attrs)
201> /opt/stack/nova/nova/api/openstack/compute/views/servers.py(92)get_show_expected_attrs()
-> def get_show_expected_attrs(self, expected_attrs=None):
###return sorted(list(set(self._show_expected_attrs + expected_attrs)))
21> /opt/stack/nova/nova/api/openstack/compute/servers.py(347)_get_servers()
-> instance_list = self.compute_api.get_all(elevated or context,search_opts=search_opts, limit=limit, marker=marker,expected_attrs=expected_attrs,
sort_keys=sort_keys, sort_dirs=sort_dirs)

211--Call--
> /opt/stack/nova/nova/compute/api.py(2226)get_all()
-> def get_all(self, context, search_opts=None, limit=None, marker=None,expected_attrs=None, sort_keys=None, sort_dirs=None):"""Get all instances filtered by one of the given parameters."""

22> /opt/stack/nova/nova/api/openstack/compute/servers.py(213)detail()
-> return servers
221> /opt/stack/nova/nova/api/openstack/extensions.py(338)wrapped()->{‘servers‘: []}
-> return f(*args, **kwargs)
222> /opt/stack/nova/nova/api/openstack/wsgi.py(749)dispatch()->{‘servers‘: []}
-> return method(req=request, **action_args)
223> /opt/stack/nova/nova/api/openstack/wsgi.py(417)__exit__()
-> def __exit__(self, ex_type, ex_value, ex_traceback):
224> /opt/stack/nova/nova/api/openstack/wsgi.py(669)_process_stack()
-> if not response:
225> /opt/stack/nova/nova/api/openstack/wsgi.py(705)_process_stack()-><Respons...c 200 OK>
-> return response
226> /opt/stack/nova/nova/api/openstack/wsgi.py(607)__call__()-><Respons...c 200 OK>
-> content_type, body, accept)
227> /usr/local/lib/python2.7/dist-packages/webob/dec.py(195)call_func()-><Respons...c 200 OK>
-> return self.func(req, *args, **kwargs)
> /usr/local/lib/python2.7/dist-packages/webob/dec.py(133)__call__()
-> if resp is None:
(Pdb) n
> /usr/local/lib/python2.7/dist-packages/webob/dec.py(136)__call__()
-> if isinstance(resp, text_type):
(Pdb) n
> /usr/local/lib/python2.7/dist-packages/webob/dec.py(138)__call__()
-> if isinstance(resp, bytes):
(Pdb) n
> /usr/local/lib/python2.7/dist-packages/webob/dec.py(142)__call__()
-> if resp is not req.response:
(Pdb) n
> /usr/local/lib/python2.7/dist-packages/webob/dec.py(143)__call__()
-> resp = req.response.merge_cookies(resp)
(Pdb) n
> /usr/local/lib/python2.7/dist-packages/webob/dec.py(144)__call__()
-> return resp(environ, start_response)
(Pdb) n
--Return--
> /usr/local/lib/python2.7/dist-packages/webob/dec.py(144)__call__()->[‘{"servers": []}‘]
-> return resp(environ, start_response)
(Pdb) n
--Return--
> /usr/local/lib/python2.7/dist-packages/webob/dec.py(144)__call__()->[‘{"servers": []}‘]
-> return resp(environ, start_response)
(Pdb) n
> /usr/local/lib/python2.7/dist-packages/routes/middleware.py(144)__call__()
-> try:

时间: 2024-10-31 04:36:30

用pdb.set_trace()设断点,跟nova/api/openstack/compute/servers.py - detail() 流程的相关文章

openstack 用nova API 指定 compute node 创建 instance

感谢朋友支持本博客,欢迎共同探讨交流,因为能力和时间有限,错误之处在所难免,欢迎指正! 假设转载,请保留作者信息. 博客地址:http://blog.csdn.net/qq_21398167 原博文地址:http://blog.csdn.net/qq_21398167/article/details/46924597 我们在博客中能够知道  能用命令行定向创建虚拟机到指定计算节点 http://blog.csdn.net/qq_21398167/article/details/46710175

nova api源码分析(二)

转载于:http://www.it165.net/pro/html/201407/17020.html (经过部分编辑) 一.使用到的库或组件如下: paste.deploy 用来解析/etc/nova/api-paste.ini文件,加载用于服务的wsgi app.它的功能有: 1.api-paste.ini中配置多个wsgi app,deploy可根据传入的app name加载指定的wsgi app: deploy.loadapp("config:/etc/nova/api-paste.in

OpenStack Mitaka Nova API 接口扩展之instance_resize

# Mitaka NOVA API 接口开发 背景: OpenStack官方默认Resize接口支持local storage 不是很好,问题很多,因此重新定 制Resize接口,实现云主机套餐变更,比之前的接口提高了很多时间 ### 配置 Resize 路由 vim /usr/lib/python2.7/site-packages/nova-13.1.0-py2.7.egg-info/entry_points.txt  [nova.api.v21.extensions]          in

Python学习 Day 12 调试 断言 logging pdb pdb.set_trace

调试 第一种方法简单直接粗暴有效,就是用print把可能有问题的变量打印出来看看: >>> def foo(s): n= int(s) print '>>> n = %d' % n return 10 / n >>> def main(): foo('0') >>> main() >>> n = 0 Traceback (most recent call last): File "<pyshell#2

nova api源码分析(一)

说明: 源码版本:H版 参考文档:http://www.choudan.net/2013/12/09/OpenStack-WSGI-APP%E5%AD%A6%E4%B9%A0.html 一.前奏 nova api本身作为一个WSGI服务器,对外提供HTTP请求服务,对内调用nova的其他模块响应相应的HTTP请求.分为两大部分,一是创建该服务器时加载的app,这个用来处理请求:一是服务器本身的启动与运行. 目录结构如下: 首先,nova api是作为一个WSGI服务,肯定要查看它的启动过程,查看

NX二次开发-NX+VS写代码设断点调试技巧

在做NX二次开发的时候写完代码,编译可以通过,但是执行的时候却没有反应,或者得到的结果不对,说明肯定有地方传值出错了.我在查找代码错误的时候有几种方法:1.uc1601打印函数输入和输出的值看对不对.2.VS设断点-添加进程调试,来看输入输出值对不对3.UF_CALL也就是UF_get_fail_message这个函数,来看函数自己用的对不对.4.查看NX-Help-LogFile(日志),拖到最后看提示了哪些错误. 我一般用的比较多的是设断点调试,这里先说设断点调试.其他方法改天再写. 写举一

WinDBG中条件字符串设断点

以我在notepad.exe中设置CreateFileW特定文件名断点为例. bp kernel32!CreateFileW "r $t1=poi(esp+4);as /mu $FileName $t1;.block{.if($sicmp(\"${$FileName}\",\"C:\\abc.txt\")!=0){.echo c:\\abc.txt}.else{.echo nonono;gc}}" bp kernel32!CreateFileW 

如何设断点????-----使用WinDbg调试SQL Server查询

http://www.cnblogs.com/woodytu/p/4665427.html http://www.sqlservercentral.com/blogs/aschenbrenner/2014/05/13/debugging-a-sql-server-query-with-windbg/ 上一篇文章我给你介绍了WinDbg的入门,还有你如何能附加到SQL Server.今天的文章,我们继续往前一步,我会向你展示使用WinDbg调试SQL Server查询需要的步骤.听起来很有意思?我

salt的api学习记录---minion的启动流程

最近在看minion的启动的源代码,一路曲折啊,经过一番努力,终于理解了流程.现在记录下,方便以后查阅. 总体来说流程如下: 1.解析命令行参数和minion配置文件,得到options和config字典 2.设置日志(salt.log.setup.setup_logfile_logger负责) 3.设置pidfile 4.根据master参数决定调用salt.minion.MultiMinion或者salt.minion.Minion初始化 5.调用tune_in方法 解析命令行参数和配置文件