Managing Images Using the CLI

The cloud operator assigns roles that grant users the ability to upload and manage images. You can upload images through the Metacloud client or the Image service API.

The Image service enables users to discover, register, and retrieve virtual machine images. It accepts API requests for disk or server images, and metadata definitions from end users or Metacloud Compute components. It also supports the storage of disk or server images on various repository types, including Object Storage.

You can use the openstack client for the image management, which provides mechanisms to list and delete images, set and delete image metadata, and create images of a running instance or snapshot and backup types.

Note
After you upload an image, you cannot change it.

Action Command
List of images $ openstack image list
Show image details $ openstack image show <IMAGE>
Create an image $ openstack image create <IMAGE> <options>
Update an image $ openstack image set <IMAGE> <options>
Upload an image $ openstack image create --file <IMAGE_FILE> <IMAGE_NAME> <options>
Delete an image $ openstack image delete <IMAGE>

Use the grep command to filter a list for a specific keyword, for example:

$ openstack image list | grep 'cirros'
| 95d786e3-0a6c-4db1-bc3c-1a184d585ff1 | cirros-0.3.4-x86_64 | active |
| d51b539b-a8a8-4274-808f-3dc96b6199a1 | cirros-0.3.3-x86_64 | active |

You can use optional arguments with the create and set commands to modify the image properties. The following example demonstrates uploading a CentOS 6.3 image in qcow2 format for public access:

$ openstack image create centos63-image \
   --disk-format qcow2 \
   --container-format bare \
   --public --file ./centos63.qcow2
Option Description
--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.
--file <FILE> Local file that contains the disk image to upload during the update. Alternatively, you can pass images to the client through stdin.
--public or --private Public makes an image accessible for all (The default is admin-only).
--protected or --unprotected Protected prevents an image from being deleted.

Setting Image Properties

To update an existing image with properties that describe the disk bus, the CD-ROM bus, and the VIF model:

 $ openstack image set <IMAGE> \
     --property hw_disk_bus=scsi \
     --property hw_cdrom_bus=ide \
     --property hw_vif_model=e1000 \ 

To set the operating system ID or a short-id in image properties:

$ openstack image set <IMAGE> --property short-id=fedora23

To set id to a URL:

$ openstack image set <IMAGE_ID> \
	--property id=http://fedoraproject.org/fedora/23