image named with uuid can't be deleted

Bug #1360130 reported by Kui Shi
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Glance
New
Undecided
Kui Shi

Bug Description

when upgrading OpenStack, we need to snapshot the vm instance and upload the image to new openstack. the snapshot image is named by "vm uuid", which can be processed by script automatically.

Upload the image named with 'vm uuid', assign the id and name same as the 'vm uuid'. then delete it.
then upload it again, only assign the name same as the 'vm uuid', then delete it with the 'vm uuid' as argument, it will fail. But deleting with the image id as argument will succeed.

"glance image-delete" can assign <id> or <name> as argument, in this case,there is some logic wrong while locating the image.

step to reproduce:

1. the image file name is a uuid. here is de58891a-3373-442d-97eb-c7aca6013c6d.
upload the image, assign the id / name same as 'uuid'.

# glance image-create --id de58891a-3373-442d-97eb-c7aca6013c6d --file de58891a-3373-442d-97eb-c7aca6013c6d --disk-format=qcow2 --container-format=bare --is-public True --name de58891a-3373-442d-97eb-c7aca6013c6d
+------------------+--------------------------------------+
| Property | Value |
+------------------+--------------------------------------+
| checksum | 64d7c1cd2b6f60c92c14662941cb7913 |
| container_format | bare |
| created_at | 2014-08-22T06:27:51 |
| deleted | False |
| deleted_at | None |
| disk_format | qcow2 |
| id | de58891a-3373-442d-97eb-c7aca6013c6d |
| is_public | True |
| min_disk | 0 |
| min_ram | 0 |
| name | de58891a-3373-442d-97eb-c7aca6013c6d |
| owner | 2c39eaafe4e347f682995e0f21c6ee65 |
| protected | False |
| size | 13167616 |
| status | active |
| updated_at | 2014-08-22T06:27:52 |
| virtual_size | None |
+------------------+--------------------------------------+

2. delete the image.

# glance image-list |grep de58891a-3373-442d-97eb-c7aca6013c6d
| de58891a-3373-442d-97eb-c7aca6013c6d | de58891a-3373-442d-97eb-c7aca6013c6d | qcow2 | bare | 13167616 | active |

# glance image-delete de58891a-3373-442d-97eb-c7aca6013c6d

# glance image-list |grep de58891a-3373-442d-97eb-c7aca6013c6d

3. create the image again, it will fail.
Because the image info is in database, it is marked as "deleted".

# glance image-create --id de58891a-3373-442d-97eb-c7aca6013c6d --file de58891a-3373-442d-97eb-c7aca6013c6d --disk-format=qcow2 --container-format=bare --is-public True --name de58891a-3373-442d-97eb-c7aca6013c6d
Request returned failure status.
409 Conflict
An image with identifier de58891a-3373-442d-97eb-c7aca6013c6d already exists
    (HTTP 409)

4. create the image, assigned "--name"with the "uuid", it will succeed.

# glance image-create --file de58891a-3373-442d-97eb-c7aca6013c6d --disk-format=qcow2 --container-format=bare --is-public True --name de58891a-3373-442d-97eb-c7aca6013c6d
+------------------+--------------------------------------+
| Property | Value |
+------------------+--------------------------------------+
| checksum | 64d7c1cd2b6f60c92c14662941cb7913 |
| container_format | bare |
| created_at | 2014-08-22T06:29:13 |
| deleted | False |
| deleted_at | None |
| disk_format | qcow2 |
| id | 4bffce52-7fc9-4a13-9dda-62d108abd772 |
| is_public | True |
| min_disk | 0 |
| min_ram | 0 |
| name | de58891a-3373-442d-97eb-c7aca6013c6d |
| owner | 2c39eaafe4e347f682995e0f21c6ee65 |
| protected | False |
| size | 13167616 |
| status | active |
| updated_at | 2014-08-22T06:29:14 |
| virtual_size | None |
+------------------+--------------------------------------+

# glance image-list |grep de58891a-3373-442d-97eb-c7aca6013c6d
| 4bffce52-7fc9-4a13-9dda-62d108abd772 | de58891a-3373-442d-97eb-c7aca6013c6d | qcow2 | bare | 13167616 | active |

5. remove the image, assign the "uuid" as argument, it will fail.

]# glance image-delete de58891a-3373-442d-97eb-c7aca6013c6d
Request returned failure status.
404 Not Found
Image de58891a-3373-442d-97eb-c7aca6013c6d not found.
    (HTTP 404): Unable to delete image de58891a-3373-442d-97eb-c7aca6013c6d

6. remove the image, assign the <id> as argument, it will succeed.

# glance image-delete 4bffce52-7fc9-4a13-9dda-62d108abd772

Kui Shi (skuicloud)
Changed in glance:
assignee: nobody → Kui Shi (skuicloud)
Revision history for this message
Mark Washenberger (markwash) wrote :

I don't think the name matters here. Rather, I believe this bug is a duplicate of https://bugs.launchpad.net/glance/+bug/1176978

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.