Glance 映像创建中的 OpenStack 身份凭证无效

Glance 映像创建中的 OpenStack 身份凭证无效
root@controller:/home/XXXXXXX# keystone token-get
+-----------+----------------------------------+
|  Property |              Value               |
+-----------+----------------------------------+
|  expires  |       2015-06-08T17:18:37Z       |
|     id    | 064fd3a2a04443aca668191a22400b18 |
| tenant_id | c3eab5d97c514aa4aec53ba1dc5aae40 |
|  user_id  | 915fa7e36fff4251ad7dd4d303ad3643 |
+-----------+----------------------------------+
root@controller:/home/XXXXXXX# source admin-openrc.sh
root@controller:/home/XXXXXXX# cat admin-openrc.sh
export OS_TENANT_NAME=XXXXXX
export OS_USERNAME=XXXXXX
export OS_PASSWORD=XXXXXX
export OS_AUTH_URL=http://controller:35357/v2.0
root@controller:/home/XXXXXXX#
root@controller:/home/XXXXXXX# glance image-create --name "cirros-0.3.3-x86_64" --file /tmp/images/cirros-0.3.3-x86_64-disk.img --disk-format qcow2 --container-format bare --is-public True --progress
[=============================>] 100%
Request returned failure status.
Invalid OpenStack Identity credentials.


PLEASE NOTE : COMMAND 'keystone service-list' GIVES TWO USERNAME AS 'glance'


root@controller:/home/XXXXXXX# keystone token-get
+-----------+----------------------------------+
|  Property |              Value               |
+-----------+----------------------------------+
|  expires  |       2015-06-08T17:18:37Z       |
|     id    | 064fd3a2a04443aca668191a22400b18 |
| tenant_id | c3eab5d97c514aa4aec53ba1dc5aae40 |
|  user_id  | 915fa7e36fff4251ad7dd4d303ad3643 |
+-----------+----------------------------------+
root@controller:/home/XXXXXXX# source admin-openrc.sh
root@controller:/home/XXXXXXX# cat admin-openrc.sh
export OS_TENANT_NAME=admin
export OS_USERNAME=admin
export OS_PASSWORD=openstack
export OS_AUTH_URL=http://controller:35357/v2.0
root@controller:/home/XXXXXXX#
root@controller:/home/XXXXXXX# glance image-create --name "cirros-0.3.3-x86_64" --file /tmp/images/cirros-0.3.3-x86_64-disk.img --disk-format qcow2 --container-format bare --is-public True --progress
[=============================>] 100%
Request returned failure status.
Invalid OpenStack Identity credentials.
root@controller:/home/XXXXXXX#
root@controller:/home/XXXXXXX#
root@controller:/home/XXXXXXX#
root@controller:/home/XXXXXXX# keystone user-list
+----------------------------------+--------+---------+-------------------------+
|                id                |  name  | enabled |          email          |
+----------------------------------+--------+---------+-------------------------+
| 915fa7e36fff4251ad7dd4d303ad3643 | admin  |   True  | [email protected] |
| d583c52f242f439c82c55351423a9f13 |  demo  |   True  | [email protected] |
| 26e2dc61f5484325800d2626d5502c5a | glance |   True  |                         |
+----------------------------------+--------+---------+-------------------------+
root@controller:/home/XXXXXXX#
root@controller:/home/XXXXXXX# keystone service-list
+----------------------------------+----------+----------+-------------------------+
|                id                |   name   |   type   |       description       |
+----------------------------------+----------+----------+-------------------------+
| 19d1a1b8b21d44a5826b6ff97857a364 |  glance  |  image   | OpenStack Image Service |
| e9559eab60ac42fcbb4cc501ee4f4537 |  glance  |  image   | OpenStack Image Service |
| 29fa1342f1d84878be9a393594b40887 | keystone | identity |    Openstack Identity   |
+----------------------------------+----------+----------+-------------------------+
root@controller:/home/XXXXXXX#
root@controller:/home/XXXXXXX# glance image-list
Request returned failure status.
Invalid OpenStack Identity credentials.
root@controller:/home/XXXXXXX#
root@controller:/home/XXXXXXX# keystone catalog
Service: image
+-------------+----------------------------------+
|   Property  |              Value               |
+-------------+----------------------------------+
|   adminURL  |      __http://controller:9292      |
|      id     | 05b95561debc4695a6c984549527d323 |
| internalURL |      __http://controller:9292      |
|  publicURL  |      __http://controller:9292      |
|    region   |            regionOne             |
+-------------+----------------------------------+
Service: identity
+-------------+----------------------------------+
|   Property  |              Value               |
+-------------+----------------------------------+
|   adminURL  |   __http://controller:35357/v2.0   |
|      id     | 2bf7fc4a8fdf4fb293133119af76820e |
| internalURL |   __http://controller:5000/v2.0    |
|  publicURL  |   __http://controller:5000/v2.0    |
|    region   |            regionOne             |
+-------------+----------------------------------+
root@controller:/home/XXXXXXX#

令人惊讶的是,glance-regisrty.conf、glance-api.conf 和 admin-openrc.sh 中的密码是相同的。请查看以下输出:

root@controller:/home/XXXXXXX# grep "admin_password" /etc/glance/glance-api.conf
#admin_password = None
admin_password = openstack
root@controller:/home/XXXXXXX# grep "admin_password" /etc/glance/glance-registry.conf
admin_password = openstack
root@controller:/home/XXXXXXX# grep "OS_PASSWORD" admin-openrc.sh
export OS_PASSWORD=openstack 

答案1

之前我收到以下错误信息:-

root@controller:/home/XXXXXX# glance image-create --name "cirros-0.3.3-x86_64" -  -file /tmp/images/cirros-0.3.3-x86_64-disk.img --disk-format qcow2 --container-format bare --is-public True --progress
[=============================>] 100%
Request returned failure status.
Invalid OpenStack Identity credentials.

glance-api.conf通过在&中更改以下内容解决了问题glance-registry.conf

[keystone_authtoken]
auth_uri = __http://controller:5000/v2.0
identity_uri = __http://controller:35357
admin_tenant_name = service
admin_user = XXXXXX
admin_password = XXXXXX

对此:

auth_host = controller
auth_port = 35357
auth_protocol = http
admin_tenant_name = service
admin_user = XXXXXX
admin_password = XXXXXX
auth_uri = __http://controller:5000

验证:

root@controller:/home/XXXXXX# nano /etc/glance/glance-api.conf                    
root@controller:/home/XXXXXX# nano /etc/glance/glance-registry.conf
root@controller:/home/XXXXXX# service glance-registry restart
glance-registry stop/waiting
glance-registry start/running, process 7550
root@controller:/home/XXXXXX# service glance-api restart
glance-api stop/waiting
glance-api start/running, process 7563
root@controller:/home/XXXXXX#
root@controller:/home/XXXXXX# source admin-openrc.sh
root@controller:/home/XXXXXX# glance image-create --name "cirros-0.3.3-x86_64" --file /tmp/images/cirros-0.3.3-x86_64-disk.img --disk-format qcow2 --container-format bare --is-public True --progress
[=============================>] 100%
+------------------+--------------------------------------+
| Property         | Value                                |
+------------------+--------------------------------------+
| checksum         | 51b8afbd2b6d36d7012280e9ede51e7e     |
| container_format | bare                                 |
| created_at       | 2015-06-08T18:14:12                  |
| deleted          | False                                |
| deleted_at       | None                                 |
| disk_format      | qcow2                                |
| id               | 9a8b12c9-f0d6-43a4-a23a-f4cc67fe89f1 |
| is_public        | True                                 |
| min_disk         | 0                                    |
| min_ram          | 0                                    |
| name             | cirros-0.3.3-x86_64                  |
| owner            | c3eab5d97c514aa4aec53ba1dc5aae40     |
| protected        | False                                |
| size             | 955802                               |
| status           | active                               |
| updated_at       | 2015-06-08T18:14:12                  |
| virtual_size     | None                                 |
+------------------+--------------------------------------+
root@controller:/home/XXXXXX# glance image-list
+--------------------------------------+---------------------+-------------+------------------+--------+--------+
| ID                                   | Name                | Disk Format | Container Format | Size   | Status |
+--------------------------------------+---------------------+-------------+------------------+--------+--------+
| 9a8b12c9-f0d6-43a4-a23a-f4cc67fe89f1 | cirros-0.3.3-x86_64 | qcow2       | bare             | 955802 | active |
+--------------------------------------+---------------------+-------------+------------------+--------+--------+

相关内容