[root@controller ~]# glance image-create --name "cirros" --file cirros-0.3.4-x86_64-disk.img --disk-format qcow2 --container-format bare --visibility public --progress
执行报错
503 Service Unavailable: The server is currently unavailable. Please try again at a later time. (HTTP 503)
查看日志文件
[root@controller ~]# tail /var/log/glance/api.log
2019-12-14 15:43:04.985 20004 INFO glance.common.wsgi [-] Child 20004 exiting normally
2019-12-14 15:45:38.483 1059 WARNING keystonemiddleware.auth_token [-] Use of the auth_admin_prefix, auth_host, auth_port, auth_protocol, identity_uri, admin_token, admin_user, admin_password, and admin_tenant_name configuration options is deprecated in favor of auth_plugin and related options and may be removed in a future release.
2019-12-14 15:45:38.486 1059 WARNING keystonemiddleware.auth_token [-] Configuring admin URI using auth fragments. This is deprecated, use 'identity_uri' instead.
2019-12-14 15:45:38.887 1059 INFO glance.common.wsgi [-] Starting 1 workers
2019-12-14 15:45:38.898 1059 INFO glance.common.wsgi [-] Started child 1869
2019-12-14 15:45:38.959 1869 INFO eventlet.wsgi.server [-] (1869) wsgi starting up on http://0.0.0.0:9292/
2019-12-14 16:39:29.378 1869 WARNING keystonemiddleware.auth_token [-] Identity response: {"error": {"message": "The request you have made requires authentication.", "code": 401, "title": "Unauthorized"}}
2019-12-14 16:39:34.773 1869 WARNING keystonemiddleware.auth_token [-] Identity response: {"error": {"message": "The request you have made requires authentication.", "code": 401, "title": "Unauthorized"}}
2019-12-14 16:39:34.776 1869 CRITICAL keystonemiddleware.auth_token [-] Unable to validate token: Identity server rejected authorization necessary to fetch token data
2019-12-14 16:39:34.811 1869 INFO eventlet.wsgi.server [-] 192.168.163.172 - - [14/Dec/2019 16:39:34] "GET /v2/schemas/image HTTP/1.1" 503 370 16.919333
加入debug
glance --debug image-create --name "cirros" --file cirros-0.3.4-x86_64-disk.img --disk-format qcow2 --container-format bare --visibility public --progress
curl -g -i -X GET -H 'Accept-Encoding: gzip, deflate' -H 'Accept: */*' -H 'X-Auth-Token: {SHA1}efdd5e8a6fd691f33b92f2ef3a846b2e8e6bac1b' -H 'Connection: keep-alive' -H 'User-Agent: python-glanceclient' -H 'Content-Type: application/octet-stream' http://controller:9292/v2/schemas/image
Request returned failure status 503.
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/glanceclient/shell.py", line 700, in main
args.func(client, args)
File "/usr/lib/python2.7/site-packages/glanceclient/common/utils.py", line 96, in func_wrapper
return func(gc, args)
File "/usr/lib/python2.7/site-packages/glanceclient/v2/shell.py", line 62, in do_image_create
schema = gc.schemas.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 280, in get
return self._request('GET', url, **kwargs)
File "/usr/lib/python2.7/site-packages/glanceclient/common/http.py", line 272, in _request
resp, body_iter = self._handle_response(resp)
File "/usr/lib/python2.7/site-packages/glanceclient/common/http.py", line 93, in _handle_response
raise exc.from_response(resp, resp.content)
HTTPServiceUnavailable: 503 Service Unavailable: The server is currently unavailable. Please try again at a later time. (HTTP 503)
503 Service Unavailable: The server is currently unavailable. Please try again at a later time. (HTTP 503)
[root@controller ~]# tail /var/log/glance/api.log
2019-12-14 16:58:46.616 5387 INFO glance.common.wsgi [-] Started child 5409
2019-12-14 16:58:46.723 5409 INFO eventlet.wsgi.server [-] (5409) wsgi starting up on http://0.0.0.0:9292/
2019-12-14 16:59:03.339 5409 WARNING keystonemiddleware.auth_token [-] Identity response: {"error": {"message": "The request you have made requires authentication.", "code": 401, "title": "Unauthorized"}}
2019-12-14 16:59:03.794 5409 WARNING keystonemiddleware.auth_token [-] Identity response: {"error": {"message": "The request you have made requires authentication.", "code": 401, "title": "Unauthorized"}}
2019-12-14 16:59:03.794 5409 CRITICAL keystonemiddleware.auth_token [-] Unable to validate token: Identity server rejected authorization necessary to fetch token data
2019-12-14 16:59:03.814 5409 INFO eventlet.wsgi.server [-] 192.168.163.172 - - [14/Dec/2019 16:59:03] "GET /v2/schemas/image HTTP/1.1" 503 370 4.363476
2019-12-14 17:00:27.582 5409 WARNING keystonemiddleware.auth_token [-] Identity response: {"error": {"message": "The request you have made requires authentication.", "code": 401, "title": "Unauthorized"}}
2019-12-14 17:00:27.902 5409 WARNING keystonemiddleware.auth_token [-] Identity response: {"error": {"message": "The request you have made requires authentication.", "code": 401, "title": "Unauthorized"}}
2019-12-14 17:00:27.903 5409 CRITICAL keystonemiddleware.auth_token [-] Unable to validate token: Identity server rejected authorization necessary to fetch token data
2019-12-14 17:00:27.921 5409 INFO eventlet.wsgi.server [-] 192.168.163.172 - - [14/Dec/2019 17:00:27] "GET /v2/schemas/image HTTP/1.1" 503 370 0.674821
发现是 /etc/glance/glance-registry.conf glance-api.conf 的问题
干脆删掉重来
#glance-registry.conf
[DEFAULT]
notification_driver = noop
verbose = True
[database]
connection = mysql://glance:123456@controller/glance
[keystone_authtoken]
auth_uri = http://controller:5000
auth_url = http://controller:35357
auth_plugin = password
project_domain_id = default
user_domain_id = default
project_name = service
username = glance
password = 123456
[paste_deploy]
flavor = keystone
#glance-api.conf
[DEFAULT]
notification_driver = noop
verbose = True
[database]
connection = mysql://glance:123456@controller/glance
[glance_store]
default_store = file
filesystem_store_datadir = /var/lib/glance/images/
[keystone_authtoken]
auth_uri = http://controller:5000
auth_url = http://controller:35357
auth_plugin = password
project_domain_id = default
user_domain_id = default
project_name = service
username = glance
password = 123456
[paste_deploy]
flavor = keystone
重启服务
[root@controller ~]#systemctl restart openstack-glance-api.service openstack-glance-registry.service
[root@controller ~]# glance image-create --name "cirros" --file cirros-0.3.4-x86_64-disk.img --disk-format qcow2 --container-format bare --visibility public --progress
[=============================>] 100%
+------------------+--------------------------------------+
| Property | Value |
+------------------+--------------------------------------+
| checksum | ee1eca47dc88f4879d8a229cc70a07c6 |
| container_format | bare |
| created_at | 2019-12-14T09:12:16Z |
| disk_format | qcow2 |
| id | d4907b29-4d2a-4da8-ad71-e6370ef1f2b8 |
| min_disk | 0 |
| min_ram | 0 |
| name | cirros |
| owner | a4ba22b6b3c4412a9c7d001963538101 |
| protected | False |
| size | 13287936 |
| status | active |
| tags | [] |
| updated_at | 2019-12-14T09:12:17Z |
| virtual_size | None |
| visibility | public |
+------------------+--------------------------------------+