glance image-create failed but image item created in database

Bug #1300364 reported by Jerry Zhao
This bug report is a duplicate of:  Bug #1257273: Glance download fails when size is 0. Edit Remove
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Glance
New
Undecided
s iwata

Bug Description

In my grizzly environment, I used glance image-create with --location option to create an image from img file stored on the internet, but because my glance server didn't have internet access, glance image-create hung there without returning success or failure, so I ctl+c to exit the command, but when glance image-list, the image I just created was there with zero size and the status was active. but, of course, it is unusable.

# glance image-create --name cirros --is-public true --container-format bare --disk-format qcow2 --location http://download.cirros-cloud.net/0.3.1/cirros-0.3.1-x86_64-disk.img

^C... terminating glance client
# glance image-list
+--------------------------------------+--------+-------------+------------------+------+--------+
| ID | Name | Disk Format | Container Format | Size | Status |
+--------------------------------------+--------+-------------+------------------+------+--------+
| a4447d2f-c036-43e1-a9c4-3dacbd22bd04 | cirros | qcow2 | bare | | active |
+--------------------------------------+--------+-------------+------------------+------+--------+

Revision history for this message
s iwata (s-iwata) wrote :

I tried checking this Bug, but I wasn't able to reproduce.
(environment is grizzly-1, grizzly-2 and grizzly-eol from tags and master branch)

How to check
1. check glance server doesn't have internet access
2. glance image-create --name cirros --is-public true --container-format bare --disk-format qcow2 --location http://download.cirros-cloud.net/0.3.1/cirros-0.3.1-x86_64-disk.img

I got 400 Bad Request.
Your glance server didn't have internet access, right?

Revision history for this message
Jerry Zhao (zhaoxinyu) wrote :

400 bad request seems a client side issue. what version of glance client are you using?
could you please also post debug logs for the command with --debug option? so we are see the http interactions.
glance --debug image-create --name cirros --is-public true --container-format bare --disk-format qcow2 --location http://download.cirros-cloud.net/0.3.1/cirros-0.3.1-x86_64-disk.img

Revision history for this message
Jerry Zhao (zhaoxinyu) wrote :

i tested on the trunk code. 400 bad request will be returned if you wait for the timeout of the image creation.
for grizzly environment i worked on, i didn't bother to wait and just ctl+c to terminate the command and as you see in my original bug description, the image can be listed as in active status but in fact it was not really there.

Revision history for this message
Jerry Zhao (zhaoxinyu) wrote :
Download full text (6.4 KiB)

 glance --debug image-create --name cirros-test --is-public true --container-format bare --disk-format qcow2 --location http://download.cirros-cloud.net/0.3.1/cirros-0.3.1-x86_64-disk.img
curl -i -X POST -H 'x-image-meta-container_format: bare' -H 'x-image-meta-location: http://download.cirros-cloud.net/0.3.1/cirros-0.3.1-x86_64-disk.img' -H 'User-Agent: python-glanceclient' -H 'x-image-meta-is_public: True' -H 'X-Auth-Token: MIIJPAYJKoZIhvcNAQcCoIIJLTCCCSkCAQExCTAHBgUrDgMCGjCCCBUGCSqGSIb3DQEHAaCCCAYEgggCeyJhY2Nlc3MiOiB7InRva2VuIjogeyJpc3N1ZWRfYXQiOiAiMjAxNC0wNS0xMFQxOToxODozMi44NDQ4NDYiLCAiZXhwaXJlcyI6ICIyMDE0LTA1LTExVDE5OjE4OjMyWiIsICJpZCI6ICJwbGFjZWhvbGRlciIsICJ0ZW5hbnQiOiB7ImRlc2NyaXB0aW9uIjogbnVsbCwgImVuYWJsZWQiOiB0cnVlLCAiaWQiOiAiMjFkMTk4MjRkMGEzNGMwYTg2YjY3ZjhhMDA0NDU0NmQiLCAibmFtZSI6ICJhZG1pbiJ9fSwgInNlcnZpY2VDYXRhbG9nIjogW3siZW5kcG9pbnRzIjogW3siYWRtaW5VUkwiOiAiaHR0cDovLzE3Mi4xNi4wLjI1Mzo4Nzc2L3YxLzIxZDE5ODI0ZDBhMzRjMGE4NmI2N2Y4YTAwNDQ1NDZkIiwgInJlZ2lvbiI6ICJSZWdpb25PbmUiLCAiaW50ZXJuYWxVUkwiOiAiaHR0cDovLzE3Mi4xNi4wLjI1Mzo4Nzc2L3YxLzIxZDE5ODI0ZDBhMzRjMGE4NmI2N2Y4YTAwNDQ1NDZkIiwgImlkIjogIjY5NmY0NzQ1Zjg0NzRjMjliMDRlYWNkYzJjZjBhNzFmIiwgInB1YmxpY1VSTCI6ICJodHRwOi8vMTcyLjE2LjAuMjUzOjg3NzYvdjEvMjFkMTk4MjRkMGEzNGMwYTg2YjY3ZjhhMDA0NDU0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ImludGVybmFsVVJMIjogImh0dHA6Ly8xNzIuMTYuMC4yNTM6OTY5NiIsICJpZCI6ICIwNmRmZGNlOTAzNDM0ODZjOTNkNzkwOGQxNWExN2ExZCIsICJwdWJsaWNVUkwiOiAiaHR0cDovLzE3Mi4xNi4wLjI1Mzo5Njk2In1dLCAiZW5kcG9pbnRzX2xpbmtzIjogW10sICJ0eXBlIjogIm5ldHdvcmsiLCAibmFtZSI6ICJxdWFudHVtIn0sIHsiZW5kcG9pbnRzIjogW3siYWRtaW5VUkwiOiAiaHR0cDovLzE3Mi4xNi4wLjI1MzozNTM1Ny92Mi4wIiwgInJlZ2lvbiI6ICJSZWdpb25PbmUiLCAiaW50ZXJuYWxVUkwiOiAiaHR0cDovLzE3Mi4xNi4wLjI1Mzo1MDAwL3YyLjAiLCAiaWQiOiAiZDFiZDFhNTA2N2RiNDZmZGI5ZTNiZDgxNjI3NmRhMTEiLCAicHVibGljVVJMIjogImh0dHA6Ly8xNzIuMTYuMC4yNTM6NTAwMC92Mi4wIn1dLCAiZW5kcG9pbnRzX2xpbmtzIjogW10sICJ0eXBlIjogImlkZW50aXR5IiwgIm5hbWUiOiAia2V5c3RvbmUifV0sICJ1c2VyIjogeyJ1c2VybmFtZSI6ICJjb25zb2xlIiwgInJvbGVzX2xpbmtzIjogW10sICJpZCI6ICI2YTAzMjRkNzc5Zjc0MWFhODdkZThkOWY4YmIyOWVhYyIsICJyb2xlcyI6IFt7Im5hbWUiOiAiYWRtaW4ifV0sICJuYW1lIjogImNvbnNvbGUifSwgIm1ldGFkYXRhIjogeyJpc19hZG1pbiI6IDAsICJyb2xlcyI6IFsiNjZhYj...

Read more...

Revision history for this message
s iwata (s-iwata) wrote :
Download full text (16.1 KiB)

Hi Jerry
Thank you for your comment.
My glance(grizzly) version is c236ab3d6e785fb9c253f3521af8b13fb2f55063.
My glance client version is 59c110365504d093f0d492390b146616d5bd351a.
I tested on that environment, but i can't see image with zero size...

■check glance server doesn't have internet access
saki@ubuntu:~$ wget google.co.jp
--2014-05-12 15:41:23-- http://google.co.jp/
Resolving google.co.jp (google.co.jp)... 173.194.126.216, 173.194.126.223, 173.194.126.215, ...
Connecting to google.co.jp (google.co.jp)|173.194.126.216|:80... failed: Connection refused.
Connecting to google.co.jp (google.co.jp)|173.194.126.223|:80... failed: Connection refused.
Connecting to google.co.jp (google.co.jp)|173.194.126.215|:80... failed: Connection refused.
Connecting to google.co.jp (google.co.jp)|2404:6800:4004:809::1018|:80... failed: Network is unreachable.

■ctl+c to terminate the command
saki@ubuntu:~$ glance --debug image-create --name cirros-test --is-public true --container-format bare --disk-format qcow2 --location http://download.cirros-cloud.net/0.3.1/cirros-0.3.1-x86_64-disk.img
curl -i -X POST -H 'x-image-meta-container_format: bare' -H 'x-image-meta-location: http://download.cirros-cloud.net/0.3.1/cirros-0.3.1-x86_64-disk.img' -H 'User-Agent: python-glanceclient' -H 'x-image-meta-is_public: True' -H 'X-Auth-Token: MIIR0AYJKoZIhvcNAQcCoIIRwTCCEb0CAQExCTAHBgUrDgMCGjCCECYGCSqGSIb3DQEHAaCCEBcEghATeyJhY2Nlc3MiOiB7InRva2VuIjogeyJpc3N1ZWRfYXQiOiAiMjAxNC0wNS0xMlQwNjo0ODo0Ny45MzM1ODIiLCAiZXhwaXJlcyI6ICIyMDE0LTA1LTEyVDA3OjQ4OjQ3WiIsICJpZCI6ICJwbGFjZWhvbGRlciIsICJ0ZW5hbnQiOiB7ImRlc2NyaXB0aW9uIjogbnVsbCwgImVuYWJsZWQiOiB0cnVlLCAiaWQiOiAiZmUyNTBhNzYwMDhlNDM4ODhlZWJhMzRkOTBjYTA4Y2IiLCAibmFtZSI6ICJhZG1pbiJ9fSwgInNlcnZpY2VDYXRhbG9nIjogW3siZW5kcG9pbnRzIjogW3siYWRtaW5VUkwiOiAiaHR0cDovLzE5Mi4xNjguMjQuMTM2Ojg3NzQvdjIvZmUyNTBhNzYwMDhlNDM4ODhlZWJhMzRkOTBjYTA4Y2IiLCAicmVnaW9u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5YmYzZTNlZjRmY2EiLCAicHVibGljVVJMIjogImh0dHA6Ly8xOTIuMTY4LjI0LjEzNjo4Nzc2L3YyL2ZlMjUwYTc2MDA4ZTQzODg4ZWViYTM0ZDkwY2EwOGNiIn1dLCAiZW5kcG9pbnRzX2xpbmtzIjogW10sICJ0eXBlIjogInZvbHVtZXYyIiwgIm5hbWUiOiAiY2luZGVydjIifSwgeyJlbmRwb2ludHMiOiBbeyJhZG1pblVSTCI6ICJodHRwOi8vMTkyLjE2O...

Revision history for this message
s iwata (s-iwata) wrote :

Hi Jerry

I tested on icehouse environment and reproduce this bug.
But i wasn't able to reproduce on the trunk code.
This bug is probably caused by client.
You might be able to close this BugRepo.

Thanks.

Revision history for this message
Jerry Zhao (zhaoxinyu) wrote :

When i tested on trunk and grizzly, trunk returned 400, which is fair enough, while grizzly return 201 if i waited long enough, but either i waited or terminate the command, the database record was created, so i doubt it was caused by client.
Since you were able to reproduce the bug on icehouse as well, this bug still applies.

Revision history for this message
s iwata (s-iwata) wrote :

I will fix icehouse code.

Changed in glance:
assignee: nobody → s iwata (s-iwata)
Revision history for this message
s iwata (s-iwata) wrote :

This bug was fixed in trunk code.
BugReport:https://bugs.launchpad.net/glance/+bug/1257273

Fix proposed to branch: stable/icehouse
Review: https://review.openstack.org/95656

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.