【时间】2014年2月25日
【平台】ubuntu 12.04.3
openstack havana with nova-network in multi-host
【日志】实例启动时输出的日志内容如下:
... ...- util.py[WARNING]: 'http://169.254.169.254/2009-04-04/meta-data/instance-id' failed [114/120s]: url error [[Errno 111] Connection refused] ... - DataSourceEc2.py[CRITICAL]: giving up on md after 121 seconds ...
【情景】multi-host模式下,由nova-network提供网络服务。当使用官方提供的ubuntu12.04镜像启用新的实例时,无法获得实例的用户名,也无法注入ssh秘钥。
最后发现实例启动时输出的日志有多行WARNING信息,提示获取metadata数据失败。
【分析】因为本人的nova相关模块部署的时间较早,版本较低,且官方安装文档提到:
nova-api-metadata
service. Accepts metadata requests from instances. The nova-api-metadata
service is generally only used when you run in multi-host mode with nova-network
installations.
On Debian systems, it is included in the nova-api
package, and can be selected through debconf.
所以根据早期版本的官方安装文档,compute节点没有安装nova-api-metadata模块。然而,根据新的官方安装文档:
So that the nova-network
service can forward metadata requests on each compute node, each compute node must install the nova-api-metadata
service, as follows:
# apt-get install nova-network nova-api-metadata
在multi-host模式下,metadata服务请求由nova-network来转发,故每个compute节点上都需要安装nova-api-metadata模块。
【解决】
在compute节点上:
#apt-get install nova-api-metadata #service nova-compute restart;service nova-network restart;service nova-api-metadata restart
在controller节点上:
#service nova-scheduler restart;service nova-api restart;service nova-cert restart;service nova-conductor restart;service nova-novncproxy restart;service nova-consoleauth restart
注意:如果很久前部署的openstack平台,那么安装nova-api-metadata模块之后,可能出现版本兼容问题。详见另一博文。
【参考】
http://docs.openstack.org/havana/install-guide/install/apt/content/compute-service.html
http://docs.openstack.org/havana/install-guide/install/apt/content/nova-network.html
http://openstack.redhat.com/forum/discussion/282/how-to-fix-sshping-to-vms-metadata-api-issue/p1
http://www.vpsee.com/2011/11/how-to-solve-datasourceec2-pywarning-http169-254-169-254-failed-url-error-problem/
https://answers.launchpad.net/nova/+question/159317
http://docs.openstack.org/admin-guide-cloud/content/section_metadata-service.html
http://www.chenshake.com/http169-254-169-2542009-04-04meta-datainstance-id-failed-url-error-errno-111-connection-refused/
http://blog.csdn.net/lynn_kong/article/details/9115033
http://blog.csdn.net/lynn_kong/article/details/9146397
http://blog.csdn.net/gtt116/article/details/17997053
https://bugs.launchpad.net/neutron/+bug/1174657