delete an image using api but the image is still uploading

Bug #1523404 reported by yanwei
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Glance
New
Undecided
Unassigned

Bug Description

1:use glance's image-create command create a new image
# glance --os-image-api-version 1 image-create --name centos7 --disk-format qcow2 --container-format bare --copy-from http://ip/images/centos.img --progress
+------------------+--------------------------------------+
| Property | Value |
+------------------+--------------------------------------+
| checksum | None |
| container_format | bare |
| created_at | 2015-12-07T17:33:02.000000 |
| deleted | False |
| deleted_at | None |
| disk_format | qcow2 |
| id | 431ddb0a-bb27-4075-a239-853e317dbce6 |
| is_public | False |
| min_disk | 0 |
| min_ram | 0 |
| name | centos7 |
| owner | 6f517af2441c4986ba94b2e98f82b8f5 |
| protected | False |
| size | 4310695936 |
| status | queued |
| updated_at | 2015-12-07T17:33:02.000000 |
| virtual_size | None |
+------------------+--------------------------------------+

2:image is uploading
# ll /var/lib/glance/images/
total 211328
-rw-r----- 1 glance glance 216399872 Dec 8 01:33 431ddb0a-bb27-4075-a239-853e317dbce6

3:use glance's image-delete command delete this image
# glance --os-image-api-version 1 image-delete 431ddb0a-bb27-4075-a239-853e317dbce6

4:the image is disappear from database but is still uploading
# glance image-list
+----+------+
| ID | Name |
+----+------+
+----+------+
# ll /var/lib/glance/images/
total 673220
-rw-r----- 1 glance glance 689373184 Dec 8 01:34 431ddb0a-bb27-4075-a239-853e317dbce6
# ll /var/lib/glance/images/
total 686532
-rw-r----- 1 glance glance 703004672 Dec 8 01:34 431ddb0a-bb27-4075-a239-853e317dbce6

5: the image file is deleted until upload completely
# ll /var/lib/glance/images/
total 4209668
-rw-r----- 1 glance glance 4310695936 Dec 8 01:39 431ddb0a-bb27-4075-a239-853e317dbce6
# ll /var/lib/glance/images/
total 0

should we kill the upload process when we delete the image by API?

Revision history for this message
Kairat Kushaev (kkushaev) wrote :

Is it reproducible on master?

Revision history for this message
Stuart McLaren (stuart-mclaren) wrote :

This is the behaviour I'd expect.

It's pretty much the same thing as how a POSIX filesystem works when a file is deleted but there is still an extant file handle.

http://stackoverflow.com/questions/2028874/what-happens-to-an-open-file-handler-on-linux-if-the-pointed-file-gets-moved-de

Revision history for this message
Kairat Kushaev (kkushaev) wrote :

Hmm, looks like we can't kill that immediately.
In case of Swift or Ceph we need to clean the data before killing the process.
We can prohibit deletion of images in saving state. Not sure if that is the right approach cause some images may hang in "saving" state.

Revision history for this message
yanwei (vxlinux) wrote :

In my environment,some images's size is huge , may be more than 100G.
if we do an image create operation by mistake,we must wait a long time until the upload complete after the image delete.
so I think if we can do some optimized improvement?

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.