错误oslo_messaging.rpc.dispatcher [req-xxxxx]消息处理期间的异常:'元数据'

时间:2015-07-31 08:43:08

标签: openstack openstack-nova

我在Centos7上安装了Openstack(Kilo)

添加安全组规则时发生错误

我正在使用Nova-network。

我从nova-compute.log

获得了此错误
2015-07-31 16:55:05.669 5950 ERROR oslo_messaging.rpc.dispatcher [req-76584058-8dbd-4860-a048-e9dbad712779 843c47b4a71b4ac3a6c4375d558aa423 3f4e979ea9b9409a9425442a8b096457 - -
-] Exception during message handling: 'metadata'
2015-07-31 16:55:05.669 5950 TRACE oslo_messaging.rpc.dispatcher Traceback (most recent call last):
2015-07-31 16:55:05.669 5950 TRACE oslo_messaging.rpc.dispatcher   File "/usr/lib/python2.7/site-packages/oslo_messaging/rpc/dispatcher.py", line 142, in _dispatch_and_reply
2015-07-31 16:55:05.669 5950 TRACE oslo_messaging.rpc.dispatcher     executor_callback))
2015-07-31 16:55:05.669 5950 TRACE oslo_messaging.rpc.dispatcher   File "/usr/lib/python2.7/site-packages/oslo_messaging/rpc/dispatcher.py", line 186, in _dispatch
2015-07-31 16:55:05.669 5950 TRACE oslo_messaging.rpc.dispatcher     executor_callback)
2015-07-31 16:55:05.669 5950 TRACE oslo_messaging.rpc.dispatcher   File "/usr/lib/python2.7/site-packages/oslo_messaging/rpc/dispatcher.py", line 130, in _do_dispatch
2015-07-31 16:55:05.669 5950 TRACE oslo_messaging.rpc.dispatcher     result = func(ctxt, **new_args)
2015-07-31 16:55:05.669 5950 TRACE oslo_messaging.rpc.dispatcher   File "/usr/lib/python2.7/site-packages/nova/compute/manager.py", line 6716, in refresh_instance_security_rules
2015-07-31 16:55:05.669 5950 TRACE oslo_messaging.rpc.dispatcher     return self.manager.refresh_instance_security_rules(ctxt, instance)
2015-07-31 16:55:05.669 5950 TRACE oslo_messaging.rpc.dispatcher   File "/usr/lib/python2.7/site-packages/nova/compute/manager.py", line 434, in decorated_function
2015-07-31 16:55:05.669 5950 TRACE oslo_messaging.rpc.dispatcher     args = (_load_instance(args[0]),) + args[1:]
2015-07-31 16:55:05.669 5950 TRACE oslo_messaging.rpc.dispatcher   File "/usr/lib/python2.7/site-packages/nova/compute/manager.py", line 425, in _load_instance
2015-07-31 16:55:05.669 5950 TRACE oslo_messaging.rpc.dispatcher     expected_attrs=metas)
2015-07-31 16:55:05.669 5950 TRACE oslo_messaging.rpc.dispatcher   File "/usr/lib/python2.7/site-packages/nova/objects/instance.py", line 492, in _from_db_object
2015-07-31 16:55:05.669 5950 TRACE oslo_messaging.rpc.dispatcher     instance['metadata'] = utils.instance_meta(db_inst)
2015-07-31 16:55:05.669 5950 TRACE oslo_messaging.rpc.dispatcher   File "/usr/lib/python2.7/site-packages/nova/utils.py", line 816, in instance_meta
2015-07-31 16:55:05.669 5950 TRACE oslo_messaging.rpc.dispatcher     if isinstance(instance['metadata'], dict):
2015-07-31 16:55:05.669 5950 TRACE oslo_messaging.rpc.dispatcher KeyError: 'metadata'
2015-07-31 16:55:05.669 5950 TRACE oslo_messaging.rpc.dispatcher

谢谢你的热心!

2 个答案:

答案 0 :(得分:0)

我也遇到了同样的错误。

首先尝试将规则添加到安全组,然后创建实例。 它对我有用。

这只是一种解决方法。由于我没有足够的权限发表评论,我将其添加为答案。

如果我了解任何解决方案,我会在这里发布。

答案 1 :(得分:0)

尽管已经过去了4年,但也许根本没人在乎根本原因,但是我还是把它放在这里了,因为我做了一些(重新)搜索。

  

object_compat装饰器希望通过以下方式获取Instance对象   'metadata'和'system_metadata'属性,但如果这些属性不在   数据库实例字典对象Instance._from_db_object将失败并显示   KeyError。

     

在Kilo中,这是根据refresh_instance_security_rules发生的,因为在   计算API代码,将实例传递给   refresh_instance_security_rules来自调用以获取   在实例列上加入的安全组,但是   不加入实例的metadata / system_metadata字段。   因此,当实例到达计算管理器中的object_compat时,   db instance dict将转换为Instance对象,它期望   不在字典中的字段,我们得到KeyError。

有关详细信息,请参见以下代码提交。

https://opendev.org/openstack/nova/commit/9369aab04e37b7818d49b00e65857be8b3564e9e