Advanced Examples of OpenStack Image Service (Glance) Usage

If you haven’t tried it already, get a free on-demand trial for Mirantis OpenStack Express, now available.

Glance can be used from the command line to do more than just add an image to a cluster. Here are some examples of what you can do with it.

  • Add an image to glance

glance image-create --name test --min-disk 1 --min-ram 768 --file \ centos-6.5-20140117.0.x86_64.qcow2 --is-public True --property net_model=e1000 --property \ disk_bus=ide --disk-format=qcow2 --container-format ovf --progress

This example makes use of the following arguments:

  --id <IMAGE_ID>    ID of image to reserve.
 --name <NAME>      Name of image.
 --store <STORE>    Store to upload image to.
To get list of images use the command:
glance image-list

You can find more information on adding images in the official OpenStack documentation.

Other Examples:

  • Creating an image

glance image-create --name "Window Server 2008 R2" --is-public=true --disk-format=qcow2 --container-format=ovf --file WIN2K8R2.qcow2
  • Transferring an image

glance image-create --name MSE-kl-test --disk-format=raw --container-format=bare --is-public=True --property hw_vif_model=e1000 --property hw_disk_bus=ide --file=MSE.raw

When transferring an image from other virtualization platforms, it’s often necessary to maintain non-OpenStack parameters through the –property argument.  For example, this technique can be useful if the image is taken from another platform such as VMware, which in this case includes these values:

hw_disk_bus=ide
hw_vif_model=e1000

These values are saved in the glance database for transfer to the VM parameters when an instances is launched from the image.

  • Delete an image

image-delete {image name}
  • Convert an image to another format

qemu-img convert -f {initial format} -O {target format}  {source file}  {destination file}

Example:

qemu-img convert -f vmdk -O qcow2 VM.vmdk VM.qcow2

Want to read more?  This article is an excerpt from our new guide, Mirantis OpenStack Express: Application On-boarding Guide (currently in beta).  Please let us know what you think.

Subscribe to Our Newsletter

Latest Tweets

Suggested Content

LIVE DEMO
Mirantis Application Platform with Spinnaker
WEBINAR
What's New in Kubernetes 1.10