Use volume utils to clone encryption

clone_encryption_key was introduced in volume_utils from this
patch https://review.opendev.org/#/c/523225/. We should use
this utils rather than the method of key manager.

Change-Id: I7f391233a7f5c383b883b6a14312220dafd0dbd9
This commit is contained in:
yenai 2019-07-26 10:40:09 +08:00
parent 821cc703c0
commit 1a788b7b5e
1 changed files with 3 additions and 3 deletions

View File

@ -30,6 +30,7 @@ from cinder import exception
from cinder.i18n import _
from cinder.policies import volume_actions as policy
from cinder import volume
from cinder.volume import volume_utils
CONF = cfg.CONF
@ -221,9 +222,8 @@ class VolumeActionsController(wsgi.Controller):
# Clone volume encryption key: the current key cannot
# be reused because it will be deleted when the volume is
# deleted.
encryption_key_id = self._key_manager.store(
context,
self._key_manager.get(context, volume.encryption_key_id))
encryption_key_id = volume_utils.clone_encryption_key(
context, self._key_manager, volume.encryption_key_id)
image_metadata['cinder_encryption_key_id'] = encryption_key_id
image_metadata['cinder_encryption_key_deletion_policy'] = \