glance API return 404 when you use image name instead of image ID

asked 2019-06-21 19:47:50 -0500

zxslm gravatar image

Hi, my openstack is using openstack(openstack 3.18.0) on CentOS7.6.1810.

when I create an instance with image name instead of image ID, Glance API return 404 instead of 200.

here my image list.

[root@os ~(keystone_demo)]# openstack image list +--------------------------------------+----------+--------+ | ID
| Name | Status | +--------------------------------------+----------+--------+ | 644f5a5a-3f8c-4eb3-b7ea-ad1268fa6bf7 | centos65 | active | | 8e51a1f8-05b3-4c7d-b522-228e4a42c21d | cirros | active | | 36775032-30fa-474e-aafc-5534faee691f | cirros01 | active | +--------------------------------------+----------+--------+

when I create instance with below command

openstack server create --flavor m1.tiny --image cirros01 --nic net-id=demo_network --security-group default01 --key-name vm1 --debug vm4

the debug output show below(404)

Instantiating image api: <class 'openstackclient.api.image_v2.apiv2'=""> curl -g -i -X GET -H 'Accept-Encoding: gzip, deflate' -H 'Accept: /' -H 'User-Agent: python-glanceclient' -H 'Connection: keep-alive' -H 'X-Auth-Token: {SHA1}98d92a1f6a83d7adb6dd4773cd2c3fba0e084004' -H 'Content-Type: application/octet-stream' http://10.107.122.87:9292/v2/images/cirros01 (http://10.107.122.87:9292/v2/images/c...) Starting new HTTP connection (1): 10.107.122.87:9292 http://10.107.122.87:9292 "GET /v2/images/cirros01 HTTP/1.1" 404153 GET call to image for http://10.107.122.87:9292/v2/images/cirros01 (http://10.107.122.87:9292/v2/images/c...) used request id req-f5e59cde-2f3d-41ce-a90d-eaa3f4323320 Request returned failure status 404.

but when i use image ID. Glance API response(200).

Instantiating image api: <class 'openstackclient.api.image_v2.apiv2'=""> curl -g -i -X GET -H 'Accept-Encoding: gzip, deflate' -H 'Accept: /' -H 'User-Agent: python-glanceclient' -H 'Connection: keep-alive' -H 'X-Auth-Token: {SHA1}c33a2fb9d28a8e331dcb4a0c78664d9fe321a66a' -H 'Content-Type: application/octet-stream' http://10.107.122.87:9292/v2/images/36775032-30fa-474e-aafc-5534faee691f (http://10.107.122.87:9292/v2/images/3...) Starting new HTTP connection (1): 10.107.122.87:9292 http://10.107.122.87:9292 "GET /v2/images/36775032-30fa-474e-aafc-5534faee691f HTTP/1.1" 200 782

The same issue happened for flavor, network and security group. if you use ID, all go well, if you use name, APIs respond with 404 even if you can show those items with openstack xxx list.

edit retag flag offensive close merge delete