Deactivating images

By default, images are available for use immediately upon completion of the uploading process. At times, it may be necessary to deactivate an image to prevent users from booting instances with the image, especially in cases where the image may be outdated but must be retained for archival purposes.

Deactivating an image

Images can be deactivated using the openstack image set command with the --deactivate argument.

Getting ready

When deactivating an image, ensure that you are authenticated as an administrator or are the owner of the image. You will need the following details, at a minimum:

  • Image name or ID

For our examples, the following will be used:

  • Image name: COOKBOOK_UBUNTU_IMAGE

How to do it…

With the OpenStack client installed on our system, we are now able to deactivate an image with the following command:

openstack image set COOKBOOK_UBUNTU_IMAGE --deactivate

No output is returned if the operation is successful. Use the openstack image show command to reveal the status of the image:

How to do it…

How it works...

When an image is deactivated in OpenStack, users are unable to boot instances using the image. Attempting to boot an instance with a deactivated image results in an error similar to the following:

Image d120a923-5246-4dca-8f52-51a951bffce5 is not active. (HTTP 400) (Request-ID: req-fb43f34c-982b-4eeb-abb1-76c93ebc2b5f)

Deactivating an image is a useful step in ensuring that images are retained but unusable. Existing instances using the image are not impacted.

Activating an image

Deactivated images can be activated using the openstack image set command with the --activate argument.

Getting ready

When activating an image, ensure that you are authenticated as an administrator or are the owner of the image. You will need the following details, at a minimum:

  • Image name or ID

For our examples, the following will be used:

  • Image name: COOKBOOK_UBUNTU_IMAGE

How to do it…

With the OpenStack client installed on our system, we are now able to activate an image with the following command:

openstack image set COOKBOOK_UBUNTU_IMAGE --activate

No output is returned if the operation is successful. Use the openstack image show command to reveal the status of the image.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.15.219.80