Skip to content

Commit

Permalink
Fix rekeying volume with legacy encryption provider
Browse files Browse the repository at this point in the history
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
  • Loading branch information
ASBishop committed Jul 7, 2020
1 parent a323a02 commit 1788a9a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions cinder/tests/unit/test_volume_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1188,6 +1188,7 @@ def test_check_encryption_provider(self, encryption_metadata):
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',
Expand Down
1 change: 1 addition & 0 deletions cinder/volume/volume_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1202,6 +1202,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)
Expand Down

0 comments on commit 1788a9a

Please sign in to comment.