Manage images 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 client or the Image Service API. You can also use the nova client to list images, set and delete image metadata, delete images, and take a snapshot of a running instance to create an image. After you upload an image, you cannot change it. For details about image creation, see the Virtual Machine Image Guide.
List or get details for images (glance) To list the available images: $ glance image-list +--------------------------------------+---------------------------------+-------------+------------------+----------+--------+ | ID | Name | Disk Format | Container Format | Size | Status | +--------------------------------------+---------------------------------+-------------+------------------+----------+--------+ | 397e713c-b95b-4186-ad46-6126863ea0a9 | cirros-0.3.1-x86_64-uec | ami | ami | 25165824 | active | | df430cc2-3406-4061-b635-a51c16e488ac | cirros-0.3.1-x86_64-uec-kernel | aki | aki | 4955792 | active | | 3cf852bd-2332-48f4-9ae4-7d926d50945e | cirros-0.3.1-x86_64-uec-ramdisk | ari | ari | 3714968 | active | | 7e5142af-1253-4634-bcc6-89482c5f2e8a | myCirrosImage | ami | ami | 14221312 | active | +--------------------------------------+---------------------------------+-------------+------------------+----------+--------+ You can use grep to filter the list, as follows: $ glance image-list | grep 'cirros' | 397e713c-b95b-4186-ad46-6126863ea0a9 | cirros-0.3.1-x86_64-uec | ami | ami | 25165824 | active | | df430cc2-3406-4061-b635-a51c16e488ac | cirros-0.3.1-x86_64-uec-kernel | aki | aki | 4955792 | active | | 3cf852bd-2332-48f4-9ae4-7d926d50945e | cirros-0.3.1-x86_64-uec-ramdisk | ari | ari | 3714968 | active | To get image details, by name or ID: $ glance image-show myCirrosImage +---------------------------------------+--------------------------------------+ | Property | Value | +---------------------------------------+--------------------------------------+ | Property 'base_image_ref' | 397e713c-b95b-4186-ad46-6126863ea0a9 | | Property 'image_location' | snapshot | | Property 'image_state' | available | | Property 'image_type' | snapshot | | Property 'instance_type_ephemeral_gb' | 0 | | Property 'instance_type_flavorid' | 2 | | Property 'instance_type_id' | 5 | | Property 'instance_type_memory_mb' | 2048 | | Property 'instance_type_name' | m1.small | | Property 'instance_type_root_gb' | 20 | | Property 'instance_type_rxtx_factor' | 1 | | Property 'instance_type_swap' | 0 | | Property 'instance_type_vcpu_weight' | None | | Property 'instance_type_vcpus' | 1 | | Property 'instance_uuid' | 84c6e57d-a6b1-44b6-81eb-fcb36afd31b5 | | Property 'kernel_id' | df430cc2-3406-4061-b635-a51c16e488ac | | Property 'owner_id' | 66265572db174a7aa66eba661f58eb9e | | Property 'ramdisk_id' | 3cf852bd-2332-48f4-9ae4-7d926d50945e | | Property 'user_id' | 376744b5910b4b4da7d8e6cb483b06a8 | | checksum | 8e4838effa1969ad591655d6485c7ba8 | | container_format | ami | | created_at | 2013-07-22T19:45:58 | | deleted | False | | disk_format | ami | | id | 7e5142af-1253-4634-bcc6-89482c5f2e8a | | is_public | False | | min_disk | 0 | | min_ram | 0 | | name | myCirrosImage | | owner | 66265572db174a7aa66eba661f58eb9e | | protected | False | | size | 14221312 | | status | active | | updated_at | 2013-07-22T19:46:42 | +---------------------------------------+--------------------------------------+
Create or update an image (glance) To upload a CentOS 6.3 image in qcow2 format and configure it for public access: $ glance image-create --name centos63-image --disk-format=qcow2 \ --container-format=bare --is-public=True ./centos63.qcow2 To update an image by name or ID: $ glance image-update IMAGE To modify image properties, use the following optional arguments: --name NAME The name of the image. --disk-format DISK_FORMAT The disk format of the image. Acceptable formats are ami, ari, aki, vhd, vmdk, raw, qcow2, vdi, and iso. --container-format CONTAINER_FORMAT The container format of the image. Acceptable formats are ami, ari, aki, bare, and ovf. --owner TENANT_ID The tenant who should own the image. --size SIZE The size of image data, in bytes. --min-disk DISK_GB The minimum size of disk needed to boot image, in gigabytes. --min-ram DISK_RAM The minimum amount of ram needed to boot image, in megabytes. --location IMAGE_URL The URL where the data for this image resides. For example, if the image data is stored in swift, you could specify swift://account:key@example.com/container/obj. --file FILE Local file that contains disk image to be uploaded during update. Alternatively, you can pass images to the client through stdin. --checksum CHECKSUM Hash of image data to use for verification. --copy-from IMAGE_URL Similar to --location in usage, but indicates that the Glance server should immediately copy the data and store it in its configured image store. --is-public [True|False] Makes an image accessible to the public. --is-protected [True|False] Prevents an image from being deleted. --property KEY=VALUE Arbitrary property to associate with image. Can be used multiple times. --purge-props Deletes all image properties that are not explicitly set in the update request. Otherwise, those properties not referenced are preserved. --human-readable Prints image size in a human-friendly format. To annotate an image with a property that describes the required VIF model: $ glance image-update \ --property hw_vif_model=e1000 f16-x86_64-openstack-sda If you specify a VIF model that is not supported, the instance fails to launch. See . The valid model values depend on the libvirt_type setting, as shown in the following table:
VIF model values
libvirt_type setting Supported model values
qemu or kvm virtio ne2k_pci pcnet rtl8139 e1000
xen netfront ne2k_pci pcnet rtl8139 e1000
Troubleshoot image creation You cannot create a snapshot from an instance that has an attached volume. Detach the volume, create the image, and re-mount the volume. Make sure the version of qemu you are using is version 0.14 or greater. Older versions of qemu result in an "unknown option -s" error message in the nova-compute.log. Examine the /var/log/nova-api.log and /var/log/nova-compute.log log files for error messages.