Chapter 7. Registering Virtual Machine Images

To test your deployment, download some virtual machine images that are known to work with OpenStack. CirrOS is a small test image that is often used for testing OpenStack deployments. You can find the most recent CirrOS image on the CirrOS Launchpad home page under "Downloads". As of this writing the most recent image is version 0.3.0. A 64-bit version in QCOW2 format (compatible with KVM or QEMU hypervisors) can be downloaded at https://launchpad.net/cirros/trunk/0.3.0/+download/cirros-0.3.0-x86_64-disk.img. Once you launch the image, log in with the following credentials:

  • Username: cirros

  • Password: cubswin:)

The 64-bit CirrOS QCOW2 image is the image we'll use for this walkthrough. More detailed information about how to obtain and create images can be found in the OpenStack Compute Administration Guide in the "Image Management" chapter.

Create a directory called stackimages to house your image files:

$ mkdir stackimages

Download the CirrOS image into your stackimages directory.

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

Verify that your glance client can access the Image service by requesting a list of installed images:

$ glance index
ID                                   Name                           Disk Format          Container Format     Size          
------------------------------------ ------------------------------ -------------------- -------------------- --------------

If you get the following error, make sure that the environment variables set in ~/openrc

Failed to show index. Got error:
You are not authenticated.
Details: 401 Unauthorized

This server could not verify that you are authorized to access the document you requested. Either you supplied the wrong credentials (e.g., bad password), or your browser does not understand how to supply the credentials required.

 Authentication required  

Add the CirrOS image to the Image service using the glance add command, passing the image file through standard input:

$ glance add name=cirros-0.3.0-x86_64 disk_format=qcow2 container_format=bare < stackimages/cirros.img
Added new image with ID: f4addd24-4e8a-46bb-b15d-fae2591f1a35

[Note]Note

The returned image ID is generated dynamically, and therefore will be different on your deployment than in this example.

The rationale for the arguments is:

name=cirros-0.3.0-x86_64

The name field is an arbitrary label. In this example the name encodes the distribution, version, and architecture: cirros-0.3.0-x864_64.

disk_format=qcow2

The disk_format field specifies the format of the image file. In this case, the image file format is QCOW2, which can be verified using the file command:

$ file stackimages/cirros.img
stackimages/cirros.img: QEMU QCOW Image (v2), 41126400 bytes

Other valid formats are raw, vhd, vmdk, vdi, iso, aki, ari and ami.

container_format=bare

The container_format field is required by the glance add command but isn't actually used by any of the OpenStack services, so the value specified here has no effect on system behavior. We specify bare to indicate that the image file is not in a file format that contains metadata about the virtual machine.

Because the value is not used anywhere, it safe to always specify bare as the container format, although the command will accept other formats: ovf, aki, ari, ami.

Confirm it was uploaded by listing the images in the Image service:

$ glance index
ID                                   Name                           Disk Format          Container Format     Size          
------------------------------------ ------------------------------ -------------------- -------------------- --------------
f4addd24-4e8a-46bb-b15d-fae2591f1a35 cirros-0.3.0-x86_64            qcow2                bare                        9761280

The nova image-list command will also list the images in the Image service:

$ nova image-list
+--------------------------------------+----------------------------------------+--------+--------------------------------------+
|                  ID                  |                  Name                  | Status |                Server                |
+--------------------------------------+----------------------------------------+--------+--------------------------------------+
| f4addd24-4e8a-46bb-b15d-fae2591f1a35 | cirros-0.3.0-x86_64                    | ACTIVE |                                      |
+--------------------------------------+----------------------------------------+--------+--------------------------------------+


loading table of contents...