Protecting images
Like other OpenStack objects, images and snapshots are susceptible to accidental deletion by users. By default, images are unprotected, meaning they can be deleted at any time by a user within a project. The following sections explain how an image can be protected to ensure its survival.
Protecting an image
Images can be protected using the openstack image set
command with the --protected
argument.
Getting ready
When protecting 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 protect an image with the following command:
openstack image set COOKBOOK_UBUNTU_IMAGE --protected
No output is returned if the operation is successful. Use the openstack image show
command to reveal the status of the image: