Images have properties known as metadata that help describe the image and how it relates to other OpenStack components. The metadata that is applied to an image can be used to enable specific functionality in other OpenStack services or to determine the scheduling of an instance to a host based on CPU architectures or features, and more.
Image metadata in OpenStack can be manipulated using the openstack image set
command. The --property
argument can be used to set additional properties using the key=value
pairs.
When setting image metadata, ensure that you are authenticated as an administrator or are the owner of the image. You will need the following details, at a minimum:
For our examples, the following will be used:
COOKBOOK_UBUNTU_IMAGE
architecture=m68k, os_distro=ubuntu
With the OpenStack client installed on our system, we are now able to set image metadata with the following command:
openstack image set COOKBOOK_UBUNTU_IMAGE --property architecture=m68k --property os_distro=ubuntu
No output is returned if the operation is successful. However, using openstack image show
will reveal that the properties have been set:
When image metadata is set in OpenStack, the properties have an impact on how the system handles instances using that image. Properties such as hypervisor_type
and architecture
affect how an instance is scheduled to a host, while other properties such as hw_disk_bus
and hw_cdrom_bus
affect how virtual devices are connected to the instance.
In this environment, booting an instance using the modified image requiring an architecture of m68k
(Motorola 68000) should result in the following error:
NoValidHost: No valid host was found. There are not enough hosts available.
Modifying the image to require x86_64
or removing the property altogether should allow the instance to be scheduled according to other defined metadata or environmental defaults.
A current list of image metadata properties at time of writing can be found at the following location:
https://docs.openstack.org/python-glanceclient/latest/cli/property-keys.html
Image metadata in OpenStack can be removed using the openstack image unset
command. The --property
argument can be used to unset individual properties.
When removing image metadata, ensure that you are authenticated as an administrator or are the owner of the image. You will need the following details, at a minimum:
For our examples, the following will be used:
COOKBOOK_UBUNTU_IMAGE
architecture
With the OpenStack client installed on our system, we are now able to unset image metadata with the following command:
openstack image unset COOKBOOK_UBUNTU_IMAGE --property architecture
No output is returned if the operation is successful. To verify that the property has been removed, use the openstack image show
command.
18.227.26.217