Command-line
Once correctly authenticated to Keystone - move your virtual machine disk file to an appropriate location either on your location workstation with OpenStack command-line tools installed, or onto the OpenStack access or login node.
Note the location of your disk image file, for example: /users/wflintstone/centos7.1.qcow2
To upload the image to the Glance image registry, run the following:
openstack image create \
--name centos7.1 \
--file /users/wflinstone/centos7.1.qcow2 \
--container-format bare \
--disk-format qcow2 \
--min-disk 8 \
--min-ram 1024 \
--property architecture=x86_64 \
--property os_distro=centos \
--property os_version=7.1 \
--progress
Optionally, rather than using a local disk file with the --file
option, publicly available images can be copied using the --copy-from <URL>
option.
The glance image-create
tool allows us to set many different variables when creating or modifying an image:
Option | Purpose |
---|---|
--name |
The image name stored in the Glance registry |
--file |
The location of the image file. Use --location URL to create an image from a web URL |
--container-format |
Specify a container format, used for specialist container types e.g. EC2 ami |
--disk-format |
The disk format of the image file, our demo uses the QCOW2 disk format |
--min-disk |
The minimum disk space required to boot the image. We recommend setting at least 8GB, although some distributions can use boot with considerably less. |
--min-ram |
The minimum memory required to boot and run the image. We recommend at least 512MB. |
--property |
The property option is used to provide metadata stored in the Glance image registry and helps to provide users with additional information about the image. |
Once the image upload has completed, we can check the status and verify successful upload, ready for use via the glance image-list
command.
[wflintstone@login1(demo) ~]$ openstack image list
+--------------------------------------+------------------+-------------+------------------+------------+--------+
| ID | Name | Disk Format | Container Format | Size | Status |
+--------------------------------------+------------------+-------------+------------------+------------+--------+
| ee163441-61b7-42fe-b06c-81e603c2e459 | centos.6.7-cloud | qcow2 | bare | 1127219200 | active |
| 43755176-d799-43e7-b3b6-b5486af087ac | centos.7.1-cloud | qcow2 | bare | 859111424 | active |
| c63abffb-1828-41fe-ae52-0f106b2c1dc9 | Cirros 0.3.4 | qcow2 | bare | 13287936 | active |
| e53b8e97-893c-4357-aca8-098731973eb2 | clusterware-el6 | qcow2 | bare | 661913600 | active |
+--------------------------------------+------------------+-------------+------------------+------------+--------+