Managing Images with CLI
This tutorial provides basic recipes for manipulating images using the PMO / OpenStack CLI client.
You will first need to install the OpenStack Glance Client on one of your systems. Follow the tutorial on Installing OpenStack CLI Clients to install the OpenStack Glance Client, and set the required environment variables.
Upload an Image from a File
Platform9 uses a few custom parameters to help improve user experience. These include:
- pf9_description: a short description that is displayed with the image in the web UI
- pf9_virtual_size: this is the size in bytes of the disk image if it were expanded to its full physical size. For raw images, this is simply the image file size. For sparse formats (like qcow2) it may be much larger than the file size. When deploying the image, Platform9 uses this value to decide whether or not the disk contents will fit on the virtual disk specified with the instance flavor. The virtual size of a disk can be viewed with the qemu-img tool:
To upload an image named ‘myimage’ with these custom properties, call glance image-create as follows:
Note that the –visibility public flag makes the image available to all tenants. Without this, it’s only available in the current tenant.
If you forget to set the virtual size when creating an image, you can always update it later:
Where virtual size is calculated (in bytes) by qemu-img info as above.
View Image Properties
Delete an Image
Managing Images in Multiple Regions
As with other OpenStack command-line clients, when managing glance images for multiple OpenStack regions, you must specify the region name for all operations using the –os-region parameter. This argument is added before the command. For example, to create the above ‘myimage’ image on the ‘williamsport-pa’ region, invoke the client as follows:
Thank you for your feedback! What did you like about this article?
Thank you for your feedback! How could this article be improved?
Thank you for your feedback!