Verifying the Image Service InstallationTo test the Image Service installation, 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 their download page. As of
this writing the most recent image is version 0.3.1. A 64-bit version in
QCOW2 format (compatible with KVM or QEMU hypervisors) can be downloaded
from there.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.The download is done in a dedicated directory:$mkdir images$cd images/$wget http://download.cirros-cloud.net/0.3.1/cirros-0.3.1-x86_64-disk.imgYou can now use the glance image-create command to
upload the image to the Image Service, passing the image file through
standard input:The following commands show --os-username,
--os-password,
--os-tenant-name,
--os-auth-url parameters. You could also use
the OS_* environment variables by setting them in
an example openrc file:Then you would source these environment variables by running source openrc.$glance --os-username=admin --os-password=secrete --os-tenant-name=demo --os-auth-url=http://192.168.206.130:5000/v2.0 \
image-create \
--name="CirrOS 0.3.1" \
--disk-format=qcow2 \
--container-format bare < cirros-0.3.1-x86_64-disk.img+------------------+--------------------------------------+
| Property | Value |
+------------------+--------------------------------------+
| checksum | d972013792949d0d3ba628fbe8685bce |
| container_format | bare |
| created_at | 2013-05-08T18:59:18 |
| deleted | False |
| deleted_at | None |
| disk_format | qcow2 |
| id | acafc7c0-40aa-4026-9673-b879898e1fc2 |
| is_public | False |
| min_disk | 0 |
| min_ram | 0 |
| name | CirrOS 0.3.1 |
| owner | efa984b0a914450e9a47788ad330699d |
| protected | False |
| size | 13147648 |
| status | active |
| updated_at | 2013-05-08T18:59:18 |
+------------------+--------------------------------------+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.1"The name field is an arbitrary label. In this example
the name encodes the distribution and version:
CirrOS 0.3.1.disk-format=qcow2The 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 cirros-0.3.1-x86_64-disk.imgcirros-0.3.1-x86_64-disk.img: QEMU QCOW Image (v2), 41126400 bytesOther valid formats are raw, vhd,
vmdk, vdi, iso,
aki, ari and
ami.container-format=bareThe container-format field is required by the
glance image-create 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 and ami.Now a glance image-list should show the image attributes:$glance --os-username=admin --os-password=secrete --os-tenant-name=demo --os-auth-url=http://192.168.206.130:5000/v2.0 \
image-list+--------------------------------------+---------------------------------+-------------+------------------+----------+--------+
| ID | Name | Disk Format | Container Format | Size | Status |
+--------------------------------------+---------------------------------+-------------+------------------+----------+--------+
| acafc7c0-40aa-4026-9673-b879898e1fc2 | CirrOS 0.3.1 | qcow2 | bare | 13147648 | active |
+--------------------------------------+---------------------------------+-------------+------------------+----------+--------+