Merge "RBD: prevent creation of encrypted volumes"

This commit is contained in:
Jenkins 2016-11-01 18:25:08 +00:00 committed by Gerrit Code Review
commit 9fcb3bf1ad
2 changed files with 13 additions and 0 deletions

View File

@ -207,6 +207,14 @@ class RBDTestCase(test.TestCase):
client.__enter__.assert_called_once_with()
client.__exit__.assert_called_once_with(None, None, None)
@common_mocks
def test_create_encrypted_volume(self):
self.volume_a.encryption_key_id = \
'00000000-0000-0000-0000-000000000000'
self.assertRaises(exception.VolumeDriverException,
self.driver.create_volume,
self.volume_a)
@common_mocks
def test_manage_existing_get_size(self):
with mock.patch.object(self.driver.rbd.Image(), 'size') as \

View File

@ -458,6 +458,11 @@ class RBDDriver(driver.TransferVD, driver.ExtendVD,
def create_volume(self, volume):
"""Creates a logical volume."""
if volume.encryption_key_id:
message = _("Encryption is not yet supported.")
raise exception.VolumeDriverException(message=message)
size = int(volume.size) * units.Gi
LOG.debug("creating volume '%s'", volume.name)