Possible data loss from createImage action
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Glance |
Triaged
|
Undecided
|
Unassigned | ||
OpenStack Compute (nova) |
Fix Released
|
High
|
Brian Rosmaita | ||
Queens |
In Progress
|
High
|
Lee Yarwood | ||
Rocky |
In Progress
|
High
|
Lee Yarwood | ||
Stein |
In Progress
|
High
|
Lee Yarwood | ||
Train |
In Progress
|
High
|
Lee Yarwood |
Bug Description
Description
===========
When an instance is booted from a image created from an encrypted Cinder volume and several images are created from that instance, deleting any one of these images will render the remaining images unusable.
The scenario
============
1. User creates a volume V-1 of an encrypted type in Cinder; Cinder automatically stores the encryption key in Barbican with key_id c-1.
2. User uploads this volume as an image to Glance as I-1. Cinder stores the encryption key in Barbican with key_id c-2 and puts the metadata
cinder_
on the image.
The idea is to preserve a 1-1 relation between key_ids and resources so that when a resource is deleted, its key in Barbican can also be deleted with no potential for data loss. This prevents cruft from accumulating in the user's Barbican account. In Train, this deletion-
cinder_
is present on the image, Glance will delete the key from Barbican when the image is deleted. Beginning with Train, Cinder puts the deletion_policy metadata on all volumes uploaded as images to Glance.
3. User boots an instance from image I-1. Nova will store all the image metadata from the image.
4. User does the createImage action on the instance. Nova creates an image I-2 and copies over the image metadata, putting
cinder_
cinder_
on the image.
5. If the user deletes I-2, key c-2 will be deleted from Barbican, thereby rendering image I-1 unusable. Similarly, if the user has created a bunch of images from the instance, deleting one of them will render all the remainder useless.
NOTE: if the user creates a volume from image I-1, Cinder will create a new Barbican secret for the resulting volume. So deleting I-1 (and hence key c-2) won't affect the usability of any volumes created from it.
This bug has been around for a while, but it required the user to manually delete the Barbican secret that multiple images depend on. The Cinder/Glance change in Train to automate the process makes this scenario much more likely to happen.
The immediate workaround is to add 'cinder_
The long term solution is for Nova to clone the encryption key in Barbican so that Nova always puts a unique key_id on the created image.
tags: | added: barbican encryption snapshot volumes |
Changed in nova: | |
importance: | Undecided → High |
Okay, so while this is a valid bug I don't think the overall use case has ever worked.
cinder_ encryption_ key_id isn't used anywhere within openstack/nova [1]. For the libvirt driver at least we only `support` ephemeral encryption with the LVM imagebackend. There we use instance. ephemeral_ key_uuid to track the key used to encrypt and then decrypt the encrypted disk(s). AFAICT this a fresh key created each time we launch an instance if CONF.ephemeral_ storage_ encryption. enabled is True [2], at no time do we lookup and/or use cinder_ encryption_ key_id from the image metadata.
As a result I can't see how we could ever launch (and importantly allow the guest OS to boot) an instance using an encrypted image that itself was created from an encrypted volume.
Do you know if this has ever been tested and if so where/how?
[1] http:// codesearch. openstack. org/?q= cinder_ encryption_ key_id& i=nope& files=& repos= /github. com/openstack/ nova/blob/ 7aa88029bbf6311 033457c32801963 da01e88ecb/ nova/compute/ api.py# L1808-L1820
[2] https:/