The cloud operator assigns roles to users. Roles determine who can upload and manage images. The operator might restrict image upload and management to only cloud administrators or operators.
You can upload images through the glance image-create or
glance image-create-via-import command or the Image service API.
You can use the glance
client for the image management. It provides
mechanisms to do all operations supported by the Images API v2.
After you upload an image, you cannot change the content, but you can update the metadata.
For details about image creation, see the Virtual Machine Image Guide.
To get a list of images and to get further details about a single image, use glance image-list and glance image-show commands.
$ glance image-list
+--------------------------------------+---------------------------------+
| ID | Name |
+--------------------------------------+---------------------------------+
| dfc1dfb0-d7bf-4fff-8994-319dd6f703d7 | cirros-0.3.5-x86_64-uec |
| a3867e29-c7a1-44b0-9e7f-10db587cad20 | cirros-0.3.5-x86_64-uec-kernel |
| 4b916fba-6775-4092-92df-f41df7246a6b | cirros-0.3.5-x86_64-uec-ramdisk |
| d07831df-edc3-4817-9881-89141f9134c3 | myCirrosImage |
+--------------------------------------+---------------------------------+
$ glance image-show d07831df-edc3-4817-9881-89141f9134c3
+------------------+------------------------------------------------------+
| Field | Value |
+------------------+------------------------------------------------------+
| checksum | 443b7623e27ecf03dc9e01ee93f67afe |
| container_format | ami |
| created_at | 2016-08-11T15:07:26Z |
| disk_format | ami |
| file | /v2/images/d07831df-edc3-4817-9881-89141f9134c3/file |
| id | d07831df-edc3-4817-9881-89141f9134c3 |
| min_disk | 0 |
| min_ram | 0 |
| name | myCirrosImage |
| os_hash_algo | sha512 |
| os_hash_value | 6513f21e44aa3da349f248188a44bc304a3653a04122d8fb4535 |
| | 423c8e1d14cd6a153f735bb0982e2161b5b5186106570c17a9e5 |
| | 8b64dd39390617cd5a350f78 |
| os_hidden | False |
| owner | d88310717a8e4ebcae84ed075f82c51e |
| protected | False |
| schema | /v2/schemas/image |
| size | 13287936 |
| status | active |
| tags | |
| updated_at | 2016-08-11T15:20:02Z |
| virtual_size | None |
| visibility | private |
+------------------+------------------------------------------------------+
When viewing a list of images, you can also use grep
to filter the
list, as follows:
$ glance image-list | grep 'cirros'
| dfc1dfb0-d7bf-4fff-8994-319dd6f703d7 | cirros-0.3.5-x86_64-uec |
| a3867e29-c7a1-44b0-9e7f-10db587cad20 | cirros-0.3.5-x86_64-uec-kernel |
| 4b916fba-6775-4092-92df-f41df7246a6b | cirros-0.3.5-x86_64-uec-ramdisk |
To create an image, use glance image-create:
$ glance image-create --name imageName
To update an image, you must specify its ID and use glance image-update:
$ glance image-update --property x="y" <IMAGE_ID>
The following list explains the commonly used properties that you can set or
modify when using the image-create
and image-update
commands.
For more information, refer to the OpenStack Useful Image Properties.
--architecture <ARCHITECTURE>
--protected [True|False]
--name <NAME>
--instance-uuid <INSTANCE_UUID>
--min-disk <MIN_DISK>
--visibility <VISIBILITY>
public
, private
,
community
, shared
--kernel-id <KERNEL_ID>
--os-version <OS_VERSION>
--disk-format <DISK_FORMAT>
active
status. Valid values: ami
, ari
, aki
, vhd
,
vhdx
, vmdk
, raw
, qcow2
, vdi
, iso
, ploop
--os-distro <OS_DISTRO>
--owner <OWNER>
--ramdisk-id <RAMDISK_ID>
--min-ram <MIN_RAM>
--container-format <CONTAINER_FORMAT>
active
status. Valid values: ami
, ari
, aki
,
bare
, ovf
, ova
, docker
, compressed
--hidden [True|False]
--property <key=value>
--remove-property key
The following example shows the command that you would use to upload a CentOS 6.3 image in qcow2 format and configure it for public access:
$ glance image-create --disk-format qcow2 --container-format bare \
--visibility public --file ./centos63.qcow2 --name centos63-image
The following example shows how to update an existing image with a properties that describe the disk bus, the CD-ROM bus, and the VIF model:
Note
When you use OpenStack with VMware vCenter Server, you need to specify
the vmware_disktype
and vmware_adaptertype
properties with
glance image-create.
Also, we recommend that you set the hypervisor_type="vmware"
property.
For more information, see Images with VMware vSphere
in the OpenStack Configuration Reference.
$ glance image-update \
--property hw_disk_bus=scsi \
--property hw_cdrom_bus=ide \
--property hw_vif_model=e1000 \
<Image-ID>
Currently the libvirt virtualization tool determines the disk, CD-ROM,
and VIF device models based on the configured hypervisor type
(libvirt_type
in /etc/nova/nova.conf
file). For the sake of optimal
performance, libvirt defaults to using virtio for both disk and VIF
(NIC) models. The disadvantage of this approach is that it is not
possible to run operating systems that lack virtio drivers, for example,
BSD, Solaris, and older versions of Linux and Windows.
If you specify a disk or CD-ROM bus model that is not supported, see the Disk_and_CD-ROM_bus_model_values_table. If you specify a VIF model that is not supported, the instance fails to launch. See the VIF_model_values_table.
The valid model values depend on the libvirt_type
setting, as shown
in the following tables.
Disk and CD-ROM bus model values
libvirt_type setting | Supported model values |
---|---|
qemu or kvm |
|
xen |
|
VIF model values
libvirt_type setting | Supported model values |
---|---|
qemu or kvm |
|
xen |
|
vmware |
|
Note
By default, hardware properties are retrieved from the image
properties. However, if this information is not available, the
libosinfo
database provides an alternative source for these
values.
If the guest operating system is not in the database, or if the use
of libosinfo
is disabled, the default system values are used.
Users can set the operating system ID or a short-id
in image
properties. For example:
$ glance image-update --property short-id=fedora23 \
<Image-ID>
You can upload ISO images to the Image service (glance). You can subsequently boot an ISO image using Compute.
In the Image service, run the following command:
$ glance image-create --name ISO_IMAGE --file IMAGE.iso \
--disk-format iso --container-format bare
Optionally, to confirm the upload in Image service, run:
$ glance image-list
If you encounter problems in creating an image in the Image service or Compute, the following information may help you troubleshoot the creation process.
unknown option -s
error message in the /var/log/nova/nova-compute.log
file./var/log/nova/nova-api.log
and
/var/log/nova/nova-compute.log
log files for error messages.Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.