diff --git a/cinder/tests/unit/volume/drivers/test_rbd.py b/cinder/tests/unit/volume/drivers/test_rbd.py index 298a9ad37..038a3365c 100644 --- a/cinder/tests/unit/volume/drivers/test_rbd.py +++ b/cinder/tests/unit/volume/drivers/test_rbd.py @@ -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 \ diff --git a/cinder/volume/drivers/rbd.py b/cinder/volume/drivers/rbd.py index 2c1e3ed70..b074d3dc5 100644 --- a/cinder/volume/drivers/rbd.py +++ b/cinder/volume/drivers/rbd.py @@ -541,6 +541,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)