summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Bishop <abishop@redhat.com>2020-07-07 10:31:55 -0700
committerAlan Bishop <abishop@redhat.com>2020-08-27 09:47:51 -0700
commit49b0c5ec6f48d38b0b5b25d49a9f225ab726c8b9 (patch)
tree90f923d35e6b42a98ef1ecda44465f8619156d8c
parent70fa875cd7f719067015b0441e02cc4137e40940 (diff)
downloadcinder-49b0c5ec6f48d38b0b5b25d49a9f225ab726c8b9.tar.gz
Fix rekeying volume with legacy encryption provider
Update volume_utils.check_encryption_provider() so it translates a legacy provider class in the encryption dict it returns. For example, if the volume's encryption metadata specifies "nova.volume.encryptors.luks.LuksEncryptor" for the provider, the function will a dict with "luks" as the provider. Closes-Bug: #1886689 Change-Id: I172dab1641207849fdd6a9848ac7573cba236a8b (cherry picked from commit 1788a9a71542eb6df8059a56c383c2e86e6f6c6b) (cherry picked from commit 2058cde4d0f8ac4128a5dc435d4950bdaba8be89)
-rw-r--r--cinder/tests/unit/test_volume_utils.py1
-rw-r--r--cinder/volume/volume_utils.py1
2 files changed, 2 insertions, 0 deletions
diff --git a/cinder/tests/unit/test_volume_utils.py b/cinder/tests/unit/test_volume_utils.py
index cc18ba8e8..444200346 100644
--- a/cinder/tests/unit/test_volume_utils.py
+++ b/cinder/tests/unit/test_volume_utils.py
@@ -1188,6 +1188,7 @@ class VolumeUtilsTestCase(test.TestCase):
volume,
mock.sentinel.context)
self.assertEqual('aes-xts-plain64', ret['cipher'])
+ self.assertEqual('luks', ret['provider'])
def test_check_encryption_provider_invalid(self):
encryption_metadata = {'cipher': 'aes-xts-plain64',
diff --git a/cinder/volume/volume_utils.py b/cinder/volume/volume_utils.py
index cd44511e3..c49cf2990 100644
--- a/cinder/volume/volume_utils.py
+++ b/cinder/volume/volume_utils.py
@@ -1197,6 +1197,7 @@ def check_encryption_provider(db, volume, context):
provider = encryption['provider']
if provider in encryptors.LEGACY_PROVIDER_CLASS_TO_FORMAT_MAP:
provider = encryptors.LEGACY_PROVIDER_CLASS_TO_FORMAT_MAP[provider]
+ encryption['provider'] = provider
if provider != encryptors.LUKS:
message = _("Provider %s not supported.") % provider
raise exception.VolumeDriverException(message=message)