Adding an image to DevStack

Posted by Dave on 26 October 2012

I had some time to play with OpenStack this week so I rolled a DevStack install on an Ubuntu VM running in Parallels on my MacBook Air following the instructions here. Once OpenStack was up and running I was able to log in to Horizon at http://localhost/ and started to poke about. I decided I wanted to try and create a compute instance just to see what all the fuss was about … as it turns out, you need to have an image to base this instance on.

With a little bit of help from the OpenStack documentation and a little bit of trial and error I was able to quickly upload an image as follows:

First things first. Create a directory for your images:

mkdir /tmp/images
cd /tmp/images

Then grab the latest CirrOs image with wget:

wget -c https://launchpad.net/cirros/trunk/0.3.0/+download/cirros-0.3.0-x86_64-disk.img

We can then upload to glance:

glance --os-username=admin --os-password=password --os-tenant-name=demo \
--os-auth-url=http://localhost:5000/v2.0 image-create --name \
cirros-0.3.0-x86_64 --disk-format qcow2 --container-format bare \
< /tmp/images/cirros-0.3.0-x86_64-disk.img

+------------------+--------------------------------------+
| Property         | Value                                |
+------------------+--------------------------------------+
| checksum         | 50bdc35edb03a38d91b1b071afb20a3c     |
| container_format | bare                                 |
| created_at       | 2012-10-26T13:10:52                  |
| deleted          | False                                |
| deleted_at       | None                                 |
| disk_format      | qcow2                                |
| id               | ccba96a2-3a61-4b3f-a5fb-9ec9b5642605 |
| is_public        | False                                |
| min_disk         | 0                                    |
| min_ram          | 0                                    |
| name             | cirros-0.3.0-x86_64                  |
| owner            | 15b7a85146c74d3299ce8b0bff0fcf2f     |
| protected        | False                                |
| size             | 9761280                              |
| status           | active                               |
| updated_at       | 2012-10-26T13:10:52                  |
+------------------+--------------------------------------+

And check it is showing as active in nova

nova --os-username=admin --os-password=password --os-tenant-name=demo --os-auth-url=http://localhost:5000/v2.0 image-list
+--------------------------------------+---------------------+--------+--------+
| ID                                   | Name                | Status | Server |
+--------------------------------------+---------------------+--------+--------+
| ccba96a2-3a61-4b3f-a5fb-9ec9b5642605 | cirros-0.3.0-x86_64 | ACTIVE |        |
+--------------------------------------+---------------------+--------+--------+

Then when you log back in to Horizon, your image will be there under the Images and Snapshots tab of the "demo" project.

And there it is!

References:

http://docs.openstack.org/essex/openstack-compute/install/yum/content/uploading-to-glance.html

[And there it is!]: