Manila/issue-neutron-on-localhost-ipv6
< Manila
我遇到了一个问题,在全新的 devstack 安装 (ubuntu-server-14.04) 上。症状如下:
2014-07-24 07:26:21.852 INFO urllib3.connectionpool [req-17b5ef32-2198-4d6f-9baf-d24c803010ba None None] Starting new HTTP connection (1): localhost
2014-07-24 07:26:21.852 DEBUG neutronclient.client [req-17b5ef32-2198-4d6f-9baf-d24c803010ba None None] throwing ConnectionFailed : HTTPConnectionPool(host='localhost', port=5000): Max retries exceeded with url: /v2.0/tokens (Caused by <class 'socket.error'>: [Errno -9] Address family for hostname not supported) from (pid=22246) _cs_request /opt/devel/openstack/python-neutronclient/neutronclient/client.py:112
2014-07-24 07:26:21.853 DEBUG manila.share.drivers.service_instance [req-17b5ef32-2198-4d6f-9baf-d24c803010ba None None] Connection to neutron failed. from (pid=22246) init /opt/devel/openstack/manila/manila/share/drivers/service_instance.py:145
2014-07-24 07:26:24.857 ERROR manila.service [req-17b5ef32-2198-4d6f-9baf-d24c803010ba None None] Unhandled exception
2014-07-24 07:26:24.857 TRACE manila.service Traceback (most recent call last):
2014-07-24 07:26:24.857 TRACE manila.service File "/opt/devel/openstack/manila/manila/service.py", line 225, in _start_child
2014-07-24 07:26:24.857 TRACE manila.service self._child_process(wrap.server)
2014-07-24 07:26:24.857 TRACE manila.service File "/opt/devel/openstack/manila/manila/service.py", line 202, in _child_process
2014-07-24 07:26:24.857 TRACE manila.service launcher.run_server(server)
2014-07-24 07:26:24.857 TRACE manila.service File "/opt/devel/openstack/manila/manila/service.py", line 93, in run_server
2014-07-24 07:26:24.857 TRACE manila.service server.start()
2014-07-24 07:26:24.857 TRACE manila.service File "/opt/devel/openstack/manila/manila/service.py", line 374, in start
2014-07-24 07:26:24.857 TRACE manila.service self.manager.init_host()
2014-07-24 07:26:24.857 TRACE manila.service File "/opt/devel/openstack/manila/manila/share/manager.py", line 76, in init_host
2014-07-24 07:26:24.857 TRACE manila.service self.driver.do_setup(ctxt)
2014-07-24 07:26:24.857 TRACE manila.service File "/opt/devel/openstack/manila/manila/share/drivers/generic.py", line 143, in do_setup
2014-07-24 07:26:24.857 TRACE manila.service driver_config=self.configuration)
2014-07-24 07:26:24.857 TRACE manila.service File "/opt/devel/openstack/manila/manila/share/drivers/service_instance.py", line 149, in init
2014-07-24 07:26:24.857 TRACE manila.service raise exception.ServiceInstanceException(_('Can not receive '
2014-07-24 07:26:24.857 TRACE manila.service ServiceInstanceException: Can not receive service tenant id.
2014-07-24 07:26:24.857 TRACE manila.service
经过一些调查,我找到了这个错误的根源。系统中安装了一个 python-dnspython 包。eventlet 包会检查 dns 模块 (dnspython) 是否存在,如果存在,则会替换 socket 的 getaddrinfo 函数。但是 eventlet 包中的 getaddrinfo 函数处理 ipv6 地址的方式不正确。在我们的例子中,它将域名 "localhost" 解析为 ::1 (使用 /etc/hosts),从而导致了这个错误。
解决方法
设置环境变量 EVENTLET_NO_GREENDNS 为任意值。或者删除
::1 localhost
来自 /etc/hosts 的内容