RUI个人博客 首页>>Openstack>>[问题] openstack mitaka 安装glance后创建镜像报错 Failed to establish a new connection

[问题] openstack mitaka 安装glance后创建镜像报错 Failed to establish a new connection

[问题] openstack mitaka 安装glance后创建镜像报错 Failed to establish a new connection
当前配置 openstack 为 mitaka
[root@controller ~]# openstack image create "cirros" --file cirros-0.3.4-x86_64-disk.img --disk-format qcow2 --container-format bare --public --debug
START with options: ['image', 'create', 'cirros', '--file', 'cirros-0.3.4-x86_64-disk.img', '--disk-format', 'qcow2', '--container-format', 'bare', '--public', '--debug']
options: Namespace(access_token_endpoint='', auth_type='', auth_url='http://controller:35357/v3', cacert='', client_id='', client_secret='***', cloud='', debug=True, default_domain='default', deferred_help=False, domain_id='', domain_name='', endpoint='', identity_provider='', insecure=None, interface='', log_file=None, os_compute_api_version='', os_identity_api_version='3', os_image_api_version='2', os_network_api_version='', os_object_api_version='', os_project_id=None, os_project_name=None, os_volume_api_version='', password='***', profile=None, project_domain_id='', project_domain_name='default', project_id='', project_name='admin', protocol='', region_name='', scope='', timing=False, token='***', trust_id='', url='', user_domain_id='', user_domain_name='default', user_id='', username='admin', verbose_level=3, verify=None)
defaults: {u'auth_type': 'password', u'compute_api_version': u'2', 'key': None, u'database_api_version': u'1.0', 'api_timeout': None, u'baremetal_api_version': u'1', u'image_api_version': u'2', 'cacert': None, u'image_api_use_tasks': False, u'floating_ip_source': u'neutron', u'orchestration_api_version': u'1', u'interface': None, u'network_api_version': u'2', u'image_format': u'qcow2', u'key_manager_api_version': u'v1', u'metering_api_version': u'2', 'verify': True, u'identity_api_version': u'2.0', u'volume_api_version': u'2', 'cert': None, u'secgroup_source': u'neutron', u'container_api_version': u'1', u'dns_api_version': u'2', u'object_store_api_version': u'1', u'disable_vendor_agent': {}}
cloud cfg: {'auth_type': 'password', u'compute_api_version': u'2', 'key': None, u'database_api_version': u'1.0', 'timing': False, u'network_api_version': u'2', u'image_format': u'qcow2', u'image_api_version': '2', 'verify': True, u'dns_api_version': u'2', u'object_store_api_version': u'1', 'verbose_level': 3, 'region_name': '', 'api_timeout': None, u'baremetal_api_version': u'1', 'auth': {'username': 'admin', 'project_name': 'admin', 'user_domain_name': 'default', 'auth_url': 'http://controller:35357/v3', 'password': '***', 'project_domain_name': 'default'}, 'default_domain': 'default', u'container_api_version': u'1', u'image_api_use_tasks': False, u'floating_ip_source': u'neutron', u'orchestration_api_version': u'1', u'interface': None, 'cacert': None, u'key_manager_api_version': u'v1', u'metering_api_version': u'2', 'deferred_help': False, u'identity_api_version': '3', u'volume_api_version': u'2', 'cert': None, u'secgroup_source': u'neutron', 'debug': True, u'disable_vendor_agent': {}}
compute API version 2, cmd group openstack.compute.v2
network API version 2, cmd group openstack.network.v2
image API version 2, cmd group openstack.image.v2
volume API version 2, cmd group openstack.volume.v2
identity API version 3, cmd group openstack.identity.v3
object_store API version 1, cmd group openstack.object_store.v1
command: image create -> openstackclient.image.v2.image.CreateImage
Auth plugin password selected
auth_type: password
Using auth plugin: password
Using parameters {'username': 'admin', 'project_name': 'admin', 'auth_url': 'http://controller:35357/v3', 'user_domain_name': 'default', 'password': '***', 'project_domain_name': 'default'}
Get auth_ref
REQ: curl -g -i -X GET http://controller:35357/v3 -H "Accept: application/json" -H "User-Agent: python-openstackclient keystoneauth1/2.4.1 python-requests/2.10.0 CPython/2.7.5"
Starting new HTTP connection (1): controller
"GET /v3 HTTP/1.1" 200 250
RESP: [200] Date: Wed, 28 Dec 2016 11:57:33 GMT Server: Apache/2.4.6 (CentOS) mod_wsgi/3.4 Python/2.7.5 Vary: X-Auth-Token x-openstack-request-id: req-cf560c16-0f82-4226-9fbd-4fc800d8bf24 Content-Length: 250 Keep-Alive: timeout=5, max=100 Connection: Keep-Alive Content-Type: application/json
RESP BODY: {"version": {"status": "stable", "updated": "2016-04-04T00:00:00Z", "media-types": [{"base": "application/json", "type": "application/vnd.openstack.identity-v3+json"}], "id": "v3.6", "links": [{"href": "http://controller:35357/v3/", "rel": "self"}]}}

Making authentication request to http://controller:35357/v3/auth/tokens
"POST /v3/auth/tokens HTTP/1.1" 201 1637
run(Namespace(checksum=None, columns=[], container_format='bare', copy_from=None, disk_format='qcow2', file='cirros-0.3.4-x86_64-disk.img', force=False, formatter='table', id=None, location=None, max_width=0, min_disk=None, min_ram=None, name='cirros', noindent=False, owner=None, prefix='', private=False, project=None, project_domain=None, properties=None, protected=False, public=True, size=None, store=None, tags=None, unprotected=False, variables=[], volume=None))
Instantiating identity client:
Instantiating image client:
Making authentication request to http://controller:35357/v3/auth/tokens
"POST /v3/auth/tokens HTTP/1.1" 201 1637
Instantiating image api:
curl -g -i -X GET -H 'Accept-Encoding: gzip, deflate' -H 'Accept: */*' -H 'X-Auth-Token: {SHA1}97a0edb70c35542cd5382aaf63b0894c2dc9b7d2' -H 'Connection: keep-alive' -H 'User-Agent: python-glanceclient' -H 'Content-Type: application/octet-stream' http://controller:9292/v2/schemas/image
Starting new HTTP connection (1): controller
Error finding address for http://controller:9292/v2/schemas/image: HTTPConnectionPool(host='controller', port=9292): Max retries exceeded with url: /v2/schemas/image (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] \xbe\xdc\xbe\xf8\xc1\xac\xbd\xd3',))
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/cliff/app.py", line 346, in run_subcommand
result = cmd.run(parsed_args)
File "/usr/lib/python2.7/site-packages/openstackclient/common/command.py", line 38, in run
return super(Command, self).run(parsed_args)
File "/usr/lib/python2.7/site-packages/cliff/display.py", line 79, in run
column_names, data = self.take_action(parsed_args)
File "/usr/lib/python2.7/site-packages/openstackclient/image/v2/image.py", line 330, in take_action
image = image_client.images.create(**kwargs)
File "/usr/lib/python2.7/site-packages/glanceclient/v2/images.py", line 228, in create
image = self.model()
File "/usr/lib/python2.7/site-packages/glanceclient/common/utils.py", line 448, in _memoized_property
setattr(self, attr_name, fn(self))
File "/usr/lib/python2.7/site-packages/glanceclient/v2/images.py", line 41, in model
schema = self.schema_client.get('image')
File "/usr/lib/python2.7/site-packages/glanceclient/v2/schemas.py", line 125, in get
_, raw_schema = self.http_client.get(uri)
File "/usr/lib/python2.7/site-packages/glanceclient/common/http.py", line 275, in get
return self._request('GET', url, **kwargs)
File "/usr/lib/python2.7/site-packages/glanceclient/common/http.py", line 256, in _request
raise exc.CommunicationError(message=message)
CommunicationError: Error finding address for http://controller:9292/v2/schemas/image: HTTPConnectionPool(host='controller', port=9292): Max retries exceeded with url: /v2/schemas/image (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] \xbe\xdc\xbe\xf8\xc1\xac\xbd\xd3',))
clean_up CreateImage: Error finding address for http://controller:9292/v2/schemas/image: HTTPConnectionPool(host='controller', port=9292): Max retries exceeded with url: /v2/schemas/image (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] \xbe\xdc\xbe\xf8\xc1\xac\xbd\xd3',))
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/openstackclient/shell.py", line 118, in run
ret_val = super(OpenStackShell, self).run(argv)
File "/usr/lib/python2.7/site-packages/cliff/app.py", line 226, in run
result = self.run_subcommand(remainder)
File "/usr/lib/python2.7/site-packages/openstackclient/shell.py", line 153, in run_subcommand
ret_value = super(OpenStackShell, self).run_subcommand(argv)
File "/usr/lib/python2.7/site-packages/cliff/app.py", line 346, in run_subcommand
result = cmd.run(parsed_args)
File "/usr/lib/python2.7/site-packages/openstackclient/common/command.py", line 38, in run
return super(Command, self).run(parsed_args)
File "/usr/lib/python2.7/site-packages/cliff/display.py", line 79, in run
column_names, data = self.take_action(parsed_args)
File "/usr/lib/python2.7/site-packages/openstackclient/image/v2/image.py", line 330, in take_action
image = image_client.images.create(**kwargs)
File "/usr/lib/python2.7/site-packages/glanceclient/v2/images.py", line 228, in create
image = self.model()
File "/usr/lib/python2.7/site-packages/glanceclient/common/utils.py", line 448, in _memoized_property
setattr(self, attr_name, fn(self))
File "/usr/lib/python2.7/site-packages/glanceclient/v2/images.py", line 41, in model
schema = self.schema_client.get('image')
File "/usr/lib/python2.7/site-packages/glanceclient/v2/schemas.py", line 125, in get
_, raw_schema = self.http_client.get(uri)
File "/usr/lib/python2.7/site-packages/glanceclient/common/http.py", line 275, in get
return self._request('GET', url, **kwargs)
File "/usr/lib/python2.7/site-packages/glanceclient/common/http.py", line 256, in _request
raise exc.CommunicationError(message=message)
CommunicationError: Error finding address for http://controller:9292/v2/schemas/image: HTTPConnectionPool(host='controller', port=9292): Max retries exceeded with url: /v2/schemas/image (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] \xbe\xdc\xbe\xf8\xc1\xac\xbd\xd3',))

[root@controller glance]# glance image-list
Error finding address for http://controller:9292/v2/images?limit=20&sort_key=name&sort_dir=asc: Unable to establish connection to http://controller:9292/v2/images?limit=20&sort_key=name&sort_dir=asc

openstack image create "cirros" --file cirros-0.3.4-x86_64-disk.img --disk-format qcow2 --container-format bare --public
执行上面的命令一直报错。所以开始一点一点排查
1. 首先对比了官方文档中的配置,难道是自己输错了?
[root@controller ~]# cat /etc/glance/glance-api.conf |grep -v ^#|grep -v ^$
[DEFAULT]
verbose = true
[cors]
[cors.subdomain]
[database]
connection = mysql+pymysql://glance:glance@controller/glance
[glance_store]
stores = file,http
default_store = file
filesystem_store_datadir = /var/lib/glance/images/
[image_format]
[keystone_authtoken]
auth_uri = http://controller:5000
auth_url = http://controller:35357
memcached_servers = controller:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = glance
password = glance
[matchmaker_redis]
[oslo_concurrency]
[oslo_messaging_amqp]
[oslo_messaging_notifications]
[oslo_messaging_rabbit]
[oslo_policy]
[paste_deploy]
flavor = keystone
[profiler]
[store_type_location_strategy]
[task]
[taskflow_executor]
[root@controller ~]# cat /etc/glance/glance-registry.conf |grep -v ^#|grep -v ^$
[DEFAULT]
[database]
connection = mysql+pymysql://glance:glance@controller/glance
[glance_store]
[keystone_authtoken]
auth_uri = http://controller:5000
auth_url = http://controller:35357
memcached_servers = controller:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = glance
password = glance
[matchmaker_redis]
[oslo_messaging_amqp]
[oslo_messaging_notifications]
[oslo_messaging_rabbit]
[oslo_policy]
[paste_deploy]
flavor = keystone
[profiler]

对比之后没有问题。

2.难道是数据库有问题?

MariaDB [glance]> show tables;
+----------------------------------+
| Tables_in_glance                 |
+----------------------------------+
| artifact_blob_locations          |
| artifact_blobs                   |
| artifact_dependencies            |
| artifact_properties              |
| artifact_tags                    |
| artifacts                        |
| image_locations                  |
| image_members                    |
| image_properties                 |
| image_tags                       |
| images                           |
| metadef_namespace_resource_types |
| metadef_namespaces               |
| metadef_objects                  |
| metadef_properties               |
| metadef_resource_types           |
| metadef_tags                     |
| migrate_version                  |
| task_info                        |
| tasks                            |
+----------------------------------+
20 rows in set (0.00 sec)
所有的表都存在,所以也没有问题。

我的解决方式:
刚开始我给镜像赋权了 chmod 777 所以没考虑到权限的问题,
最后尝试改了一下用户和数组,创建成功了 (具体原因有待以后分析,先记录下)
[root@controller ~]# ll
总用量 4222660
-rw-------. 1 root root 1279 12月 26 13:07 anaconda-ks.cfg
-rw-r--r--. 1 root root 4310695936 7月 30 2015 CentOS-7-x86_64-DVD-1503-01.iso
-rwxrwxrwx. 1 glance glance 13287936 12月 28 17:07 cirros-0.3.4-x86_64-disk.img
-rw-r--r--. 1 root root 272 12月 28 12:43 openrc
-rw-r--r--. 1 root root 269 12月 28 12:44 openrcdemo
[root@controller ~]# source openrc
[root@controller ~]# glance image-list
+--------------------------------------+--------+
| ID | Name |
+--------------------------------------+--------+
| 164f1add-8f84-45f4-9e23-bf6766f9ea4c | cirros |
+--------------------------------------+--------+

思考:每个人的环境都可能遇到问题不一样,遇到问题自己一点一点排查,总会解决的。。。。

2016.12.28 于 北京广安家传   tyger.wang


昵  称:
邮  箱:
评论内容:
验 证 码:
可用[code][/code]插入代码
点击刷新验证码