Create image by openstack api?

asked 2016-12-28 23:01:29 -0500

xuananh gravatar image

I do create image by these code:

curl -s -H "X-Auth-Token: $OS_TOKEN" \ $OS_IMAGE_API/v2/images \ -d '{"container_format": "bare", "disk_format": "qcow2", "name": "test", "location":""}' \ | python -m json.tool

But the image persistent in queued status Anybody know how to create image, pls tell me, thanks!

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted

answered 2016-12-29 00:33:00 -0500

updated 2016-12-29 00:36:26 -0500

This is expected. See the comment in the API doc: "With correct permissions, you can see the image status as queued through API calls.". You just accomplished the first step, creating an image record in the database. As a second step, you need to upload the image data.

By the way, your curl command has to be a POST, not a GET (but I think this is just a typo).

edit flag offensive delete link more


I uploaded image ask you said and encounter other error: HTTP/1.1 100 Continue HTTP/1.1 204 No Content Content-Type: text/html; charset=UTF-8 Content-Length: 0 The image status change to active but It seem upload process not finish because size of image is small than the real, I can't boot this imag

xuananh gravatar imagexuananh ( 2016-12-29 01:34:09 -0500 )edit

After I change option -d to --data-binary in curl command, I uploaded successfully image from local, but I can't upload image from internet url, how to do that?

xuananh gravatar imagexuananh ( 2016-12-29 02:52:14 -0500 )edit

Glance v2 API doesn't allow upload from a URL afaik. See comment in the openstack client doc:

--location <image-url>
    Download image from an existing URL
    Image version 1 only.
Bernd Bausch gravatar imageBernd Bausch ( 2016-12-29 05:25:43 -0500 )edit

answered 2016-12-28 23:49:55 -0500

silently gravatar image

I think format is error.

glance image-create --name "cirros-0.3.3-x86_64" --file cirros-0.3.3-x86_64-disk.img --disk-format qcow2 --container-format bare --visibility public --progress


openstack image create "cirros"   --file cirros-0.3.4-x86_64-disk.img   --disk-format qcow2 --container-format bare  --public

after create image okay, see log file ,you will see the right request format in log file .

or use the --debug as option when use creating commend.

edit flag offensive delete link more


I can create image by command as you issued, but I want to create my app to interact with openstack by using openstack request api, do you have any idea? Thanks!

xuananh gravatar imagexuananh ( 2016-12-29 00:09:12 -0500 )edit

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower


Asked: 2016-12-28 23:01:29 -0500

Seen: 1,031 times

Last updated: Dec 29 '16