← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1360130] [NEW] image named with uuid can't be deleted

 

Public bug reported:

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

** Affects: glance
     Importance: Undecided
     Assignee: Kui Shi (skuicloud)
         Status: New

** Changed in: glance
     Assignee: (unassigned) => Kui Shi (skuicloud)

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to Glance.
https://bugs.launchpad.net/bugs/1360130

Title:
  image named with uuid can't be deleted

Status in OpenStack Image Registry and Delivery Service (Glance):
  New

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

To manage notifications about this bug go to:
https://bugs.launchpad.net/glance/+bug/1360130/+subscriptions


Follow ups

References