nova-api调试记录以及方法

    用 python  nova-api   --glance_port=9292 --glance_api_servers=10.28.163.158:9292 --osapi_compute_listen_port=8774 --osapi_compute_listen=0.0.0.0 --osapi_compute_listen_port=8774 --ec2_dmz_host=169.254.169.254 --osapi_volume_listen=0.0.0.0 --osapi_volume_listen_port=8776 --ec2_listen=0.0.0.0 --ec2_listen_port=8773 --lock_path=/var/lock/nova --state_path=/home/nova --connection_type=libvirt --metadata_listen_port=8775 --log-dir=/var/log/nova --sql_connection=mysql://nova:[email protected]/nova --glance_host=10.28.163.158  --ec2_dmz_host=169.254.169.254 --default_instance_type=6 --metadata_listen=0.0.0.0 --metadata_listen_port=8775 --osapi_volume_listen_port=8776 --ec2_listen_port=8773 --glance_host=10.28.163.158 --network_manager=nova.network.manager.FlatDHCPManager --root_helper=sudo --bindir=/usr/bin --auth_strategy=keystone --node_availability_zone=nova --api_paste_config=/etc/nova/api-paste.ini

启动nova-api报错:

2012-08-23 10:20:58 ERROR nova.wsgi [-] URI scheme not known: 'call' (from egg, config)
URI scheme not known: 'call' (from egg, config)
*** PasteAppNotFound: Could not load paste app 'ec2' from /etc/nova/api-paste.ini

不太明白什么意思,那就加上-m pdb调试一把,发现报错在:

/usr/lib/python2.6/site-packages/nova-2012.2-py2.6.egg/nova/service.py:575
/usr/lib/python2.6/site-packages/nova-2012.2-py2.6.egg/nova/service.py:574 附近

然后跟进去主要在:

577  ->         self.app = self.loader.load_app(name) 这一样报错,

继续跟到函数里面去:

更进去分析
370  ->             LOG.debug(_("Loading app %(name)s from %(path)s") %
371                           {'name': name, 'path': self.config_path})
372                 return deploy.loadapp("config:%s" % self.config_path, name=name)
373             except LookupError as err:
374                 LOG.error(err)
375                 raise exception.PasteAppNotFound(name=name, path=self.config_path)
(Pdb) pp deploy
<module 'paste.deploy' from '/usr/lib/python2.6/site-packages/paste/deploy/__init__.pyc'>
(Pdb) pp self.config_path
'/etc/nova/api-paste.ini'
(Pdb) pp name
'ec2'

原来是执行deploy.loadapp 函数报错,这样就好办了,拿出来单独执行。

[root@xgtest scripts]# python
Python 2.6.6 (r266:84292, Jun 18 2012, 14:18:47)
[GCC 4.4.6 20110731 (Red Hat 4.4.6-3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from paste import deploy
>>> deploy
<module 'paste.deploy' from '/usr/lib/python2.6/site-packages/paste/deploy/__init__.pyc'>
>>> deploy.loadapp('config:/etc/nova/api-paste.ini',name='ec2')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.6/site-packages/paste/deploy/loadwsgi.py", line 204, in loadapp
    return loadobj(APP, uri, name=name, **kw)
  File "/usr/lib/python2.6/site-packages/paste/deploy/loadwsgi.py", line 225, in loadobj
    return context.create()
  File "/usr/lib/python2.6/site-packages/paste/deploy/loadwsgi.py", line 625, in create
    return self.object_type.invoke(self)
  File "/usr/lib/python2.6/site-packages/paste/deploy/loadwsgi.py", line 108, in invoke
    **context.local_conf)
  File "/usr/lib/python2.6/site-packages/paste/deploy/util/fixtypeerror.py", line 57, in fix_call
    val = callable(*args, **kw)
  File "/usr/lib/python2.6/site-packages/paste/urlmap.py", line 25, in urlmap_factory
    app = loader.get_app(app_name, global_conf=global_conf)
  File "/usr/lib/python2.6/site-packages/paste/deploy/loadwsgi.py", line 297, in get_app
    name=name, global_conf=global_conf).create()
  File "/usr/lib/python2.6/site-packages/paste/deploy/loadwsgi.py", line 309, in app_context
    APP, name=name, global_conf=global_conf)
  File "/usr/lib/python2.6/site-packages/paste/deploy/loadwsgi.py", line 409, in get_context
    section)
  File "/usr/lib/python2.6/site-packages/paste/deploy/loadwsgi.py", line 431, in _context_from_use
    object_type, name=use, global_conf=global_conf)
  File "/usr/lib/python2.6/site-packages/paste/deploy/loadwsgi.py", line 361, in get_context
    global_conf=global_conf)
  File "/usr/lib/python2.6/site-packages/paste/deploy/loadwsgi.py", line 244, in loadcontext
    % (scheme, ', '.join(_loaders.keys())))
LookupError: URI scheme not known: 'call' (from egg, config)

这个错误和上面的错误一致,可以单独拿出来直接执行,这估计也是python的魅力之一吧,然后集中精力把这个问题解决。

 

你可能感兴趣的:(api,openstack,nova)