To test the Image Service installation, download at least one virtual machine image that is known to work with OpenStack. For example, CirrOS is a small test image that is often used for testing OpenStack deployments (CirrOS downloads). This walk through uses the 64-bit CirrOS QCOW2 image.
For more information about how to download and build images, see OpenStack Virtual Machine Image Guide. For information about how to manage images, see the OpenStack User Guide.
Download the image into a dedicated directory using wget or curl:
$ mkdir images $ cd images/ $ wget http://cdn.download.cirros-cloud.net/0.3.2/cirros-0.3.2-x86_64-disk.img
Upload the image to the Image Service:
$ glance image-create --name=
IMAGELABEL
--disk-format=FILEFORMAT
\ --container-format=CONTAINERFORMAT
--is-public=ACCESSVALUE
<IMAGEFILE
Where:
IMAGELABEL
Arbitrary label. The name by which users refer to the image.
FILEFORMAT
Specifies the format of the image file. Valid formats include
qcow2
,raw
,vhd
,vmdk
,vdi
,iso
,aki
,ari
, andami
.You can verify the format using the file command:
$ file cirros-0.3.2-x86_64-disk.img cirros-0.3.2-x86_64-disk.img: QEMU QCOW Image (v2), 41126400 bytes
CONTAINERFORMAT
Specifies the container format. Valid formats include:
bare
,ovf
,aki
,ari
andami
.Specify
bare
to indicate that the image file is not in a file format that contains metadata about the virtual machine. Although this field is currently required, it is not actually used by any of the OpenStack services and has no effect on system behavior. Because the value is not used anywhere, it is safe to always specifybare
as the container format.ACCESSVALUE
Specifies image access:
true - All users can view and use the image.
false - Only administrators can view and use the image.
IMAGEFILE
Specifies the name of your downloaded image file.
For example:
$ source admin-openrc.sh $ glance image-create --name "cirros-0.3.2-x86_64" --disk-format qcow2 \ --container-format bare --is-public True --progress < cirros-0.3.2-x86_64-disk.img +------------------+--------------------------------------+ | Property | Value | +------------------+--------------------------------------+ | checksum | 64d7c1cd2b6f60c92c14662941cb7913 | | container_format | bare | | created_at | 2014-04-08T18:59:18 | | deleted | False | | deleted_at | None | | disk_format | qcow2 | | id | acafc7c0-40aa-4026-9673-b879898e1fc2 | | is_public | True | | min_disk | 0 | | min_ram | 0 | | name | cirros-0.3.2-x86_64 | | owner | efa984b0a914450e9a47788ad330699d | | protected | False | | size | 13167616 | | status | active | | updated_at | 2014-01-08T18:59:18 | +------------------+--------------------------------------+
Note Because the returned image ID is generated dynamically, your deployment generates a different ID than the one shown in this example.
Confirm that the image was uploaded and display its attributes:
$ glance image-list
+--------------------------------------+---------------------+-------------+------------------+----------+--------+ | ID | Name | Disk Format | Container Format | Size | Status | +--------------------------------------+---------------------+-------------+------------------+----------+--------+ | acafc7c0-40aa-4026-9673-b879898e1fc2 | cirros-0.3.2-x86_64 | qcow2 | bare | 13167616 | active | +--------------------------------------+---------------------+-------------+------------------+----------+--------+
Alternatively, the upload to the Image Service can be done without having to use local disk space to store the file, by use of the --copy-from
parameter.
For example:
$ glance image-create --name="cirros-0.3.2-x86_64" --disk-format=qcow2 \ --container-format=bare --is-public=true \ --copy-from http://cdn.download.cirros-cloud.net/0.3.2/cirros-0.3.2-x86_64-disk.img +------------------+--------------------------------------+ | Property | Value | +------------------+--------------------------------------+ | checksum | 64d7c1cd2b6f60c92c14662941cb7913 | | container_format | bare | | created_at | 2014-04-08T06:13:18 | | deleted | False | | disk_format | qcow2 | | id | 3cce1e32-0971-4958-9719-1f92064d4f54 | | is_public | True | | min_disk | 0 | | min_ram | 0 | | name | cirros-0.3.2-x86_64 | | owner | efa984b0a914450e9a47788ad330699d | | protected | False | | size | 13167616 | | status | active | | updated_at | 2014-04-08T06:13:20 | +------------------+--------------------------------------+