Another quick note for myself about OpenStack. Quite often I see glance images that cannot be deleted because they are "protected". This post shows how to deal with such OpenStack glance images.
Why Some OpenStack glance Images are Protected
Simply put, "protected" is a read-only flag for your server image in OpenStack. When creating or managing glance images, it's possible to make some of them as "protected" – meaning any destructive operation on them will get rejected by OpenStack web and CLI interfaces.
Can't Delete: OpenStack Image is Protected
I will follow up and update this post with the exact error message once I get a chance to work in an OpenStack lab again, but for now this is a placeholder.
When you're running the standard server image deletion in OpenStack, you'll get an error.
Here's a command and approximately how the issue would look:
$ openstack image delete <IMAGE-ID> Failed to delete image with name or ID 'IMAGE-ID': 403 Forbidden: Image IMAGE-ID is protected and cannot be deleted. (HTTP 403) Failed to delete 1 of 1 images.
How To Delete Protected Server Image in OpenStack
Naturally, the first step to deleting a protected image is to unprotect it. You can simply set a flag to make image non-protected. This is the command to activate the unprotected property for a given image:
$ openstack image set --unprotected <IMAGE-ID>
After successful completion of the above command, you can attempt deleting the server image again as shown above.
- OpenStack Reference
- Show Servers Across All OpenStack Projects