连接到 openstack 失败
Connect to openstack is failing
我写了一些 python 代码来与 Openstack 实例交互;使用 shade 库。
来电
myinstance = shade.openstack_cloud(cloud='mycloud', **auth_data)
在我的本地 Ubuntu 安装上运行良好;但在我们的 "backend" 服务器 (运行 RHEL 7.2) 上失败了。
File "mystuff/core.py", line 248, in _create_connection
myinstance = shade.openstack_cloud(cloud='mycloud', **auth_data)
File "/usr/local/lib/python3.5/site-packages/shade-1.20.0-py3.5.egg/shade/init.py", line 106, in openstack_cloud
return OpenStackCloud(cloud_config=cloud_config, strict=strict)
File "/usr/local/lib/python3.5/site-packages/shade-1.20.0-py3.5.egg/shade/openstackcloud.py", line 312, in init
self._local_ipv6 = _utils.localhost_supports_ipv6()
File "/usr/local/lib/python3.5/site-packages/shade-1.20.0-py3.5.egg/shade/_utils.py", line 254, in localhost_supports_ipv6
return netifaces.AF_INET6 in netifaces.gateways()['default']
AttributeError: module 'netifaces' has no attribute 'AF_INET6'
该系统的管理员告诉我那里没有启用 IPv6;也许这解释了失败。我做了一些研究,但找不到任何可以防止失败的方法。
欢迎任何想法。
更新:我编辑了我的clouds.yml;它看起来像这样:
# openstack/shade config file
# required to connect provisioning using the shade module
client:
force_ipv4: true
clouds:
mycloud:
auth:
user_domain_name: xxx
auth_url: 'someurl'
region_name: RegionOne
我也试过 export OS_FORCE_IPV4=True
- 但错误信息仍然存在。
如果您浏览 OpenStack os-client-config documentation,他们提到了 IPV6
相关问题。
IPv6 is the future, and you should always use it if your cloud
supports it and if your local network supports it. Both of those are
easily detectable and all friendly software should do the right thing.
However, sometimes you might exist in a location where you have an
IPv6 stack, but something evil has caused it to not actually function.
In that case, there is a config option you can set to unbreak you
force_ipv4, or OS_FORCE_IPV4 boolean environment variable.
因此,使用这些 boolean
配置,您可以强制使用适当的网络协议。将以下行添加到您的 clouds.yaml
文件
client:
force_ipv4: true
将强制 IPV4
并希望它能解决您的问题。
OP 编辑:不幸的是以上没有帮助;通过修改 shade-1.20.0-py3.5.egg/shade/_utils.py
修复了它:我更改了 return 语句
return netifaces.AF_INET6 in netifaces.gateways()['default']`
简单
return False
一切正常。当然,这只是一种解决方法;但也提交了错误报告。
我写了一些 python 代码来与 Openstack 实例交互;使用 shade 库。
来电
myinstance = shade.openstack_cloud(cloud='mycloud', **auth_data)
在我的本地 Ubuntu 安装上运行良好;但在我们的 "backend" 服务器 (运行 RHEL 7.2) 上失败了。
File "mystuff/core.py", line 248, in _create_connection myinstance = shade.openstack_cloud(cloud='mycloud', **auth_data)
File "/usr/local/lib/python3.5/site-packages/shade-1.20.0-py3.5.egg/shade/init.py", line 106, in openstack_cloud return OpenStackCloud(cloud_config=cloud_config, strict=strict)
File "/usr/local/lib/python3.5/site-packages/shade-1.20.0-py3.5.egg/shade/openstackcloud.py", line 312, in init self._local_ipv6 = _utils.localhost_supports_ipv6()
File "/usr/local/lib/python3.5/site-packages/shade-1.20.0-py3.5.egg/shade/_utils.py", line 254, in localhost_supports_ipv6 return netifaces.AF_INET6 in netifaces.gateways()['default']
AttributeError: module 'netifaces' has no attribute 'AF_INET6'
该系统的管理员告诉我那里没有启用 IPv6;也许这解释了失败。我做了一些研究,但找不到任何可以防止失败的方法。
欢迎任何想法。
更新:我编辑了我的clouds.yml;它看起来像这样:
# openstack/shade config file
# required to connect provisioning using the shade module
client:
force_ipv4: true
clouds:
mycloud:
auth:
user_domain_name: xxx
auth_url: 'someurl'
region_name: RegionOne
我也试过 export OS_FORCE_IPV4=True
- 但错误信息仍然存在。
如果您浏览 OpenStack os-client-config documentation,他们提到了 IPV6
相关问题。
IPv6 is the future, and you should always use it if your cloud supports it and if your local network supports it. Both of those are easily detectable and all friendly software should do the right thing. However, sometimes you might exist in a location where you have an IPv6 stack, but something evil has caused it to not actually function. In that case, there is a config option you can set to unbreak you force_ipv4, or OS_FORCE_IPV4 boolean environment variable.
因此,使用这些 boolean
配置,您可以强制使用适当的网络协议。将以下行添加到您的 clouds.yaml
文件
client:
force_ipv4: true
将强制 IPV4
并希望它能解决您的问题。
OP 编辑:不幸的是以上没有帮助;通过修改 shade-1.20.0-py3.5.egg/shade/_utils.py
修复了它:我更改了 return 语句
return netifaces.AF_INET6 in netifaces.gateways()['default']`
简单
return False
一切正常。当然,这只是一种解决方法;但也提交了错误报告。