其他分享
首页 > 其他分享> > OpenStack Nova 代码调试

OpenStack Nova 代码调试

作者:互联网

OpenStack Nova 代码调试

1 部署 Kolla-ansible

2 查看映射是否生效

{
"Type": "bind",
"Source": "/opt/stack/nova/nova",
"Destination": "/var/lib/kolla/venv/lib/python3.6/site-packages/nova",
"Mode": "rw",
"RW": true,
"Propagation": "rprivate"
},

3 成功后的现象

修改/opt/stack下nova源码,docker restart nova_compute即可生效。

4 pdb调试

$ docker exec -it -u root nova_compute pip install remote_pdb
def index(self, req):
		from remote_pdb import set_trace
        set_trace()  # 加入断点
        # from remote_pdb import RemotePdb
		# RemotePdb('127.0.0.1', 4444).set_trace()
        """Returns a list of server names and ids for a given user."""
        context = req.environ['nova.context']
        context.can(server_policies.SERVERS % 'index')
        try:
            servers = self._get_servers(req, is_detail=False)
        except exception.Invalid as err:
            raise exc.HTTPBadRequest(explanation=err.format_message())
        return servers
# 此处为了查询 telnet 连接的端口号
$ docker restart nova_compute
telnet host:port #  telnet 127.0.0.1:4444

标签:Nova,remote,nova,源码,telnet,调试,OpenStack,pdb,kolla
来源: https://www.cnblogs.com/FutureHolmes/p/15329931.html