smbfs: pick up remotefs method signature change

A recent commit [1] changed the remotefs "_copy_volume_from_snapshot"
method signature.

This change has to be propagated to the SMBFS driver, otherwise
creating volumes from snapshots will fail with a TypeError[2].

[1] I896f70d204ad103e968ab242ba9045ca984827c4
[2] http://paste.openstack.org/raw/795653/

Change-Id: I6004e1a1bfa23627097a7e57d035667ebd8450fb
This commit is contained in:
Lucian Petrut 2020-07-08 14:15:22 +03:00
parent a323a026f4
commit 86877a7d47
2 changed files with 20 additions and 1 deletions

View File

@ -847,6 +847,17 @@ class WindowsSmbFsTestCase(test.TestCase):
self.volume.size * units.Gi,
is_file_max_size=False)
def test_copy_encrypted_volume_from_snapshot(self):
# We expect an exception to be raised if an encryption
# key is provided since we don't support encryted volumes
# for the time being.
self.assertRaises(exception.NotSupportedOperation,
self._smbfs_driver._copy_volume_from_snapshot,
self.snapshot, self.volume,
self.volume.size,
mock.sentinel.src_key,
mock.sentinel.dest_key)
def test_rebase_img(self):
drv = self._smbfs_driver
drv._rebase_img(

View File

@ -606,9 +606,17 @@ class WindowsSmbfsDriver(remotefs_drv.RevertToSnapshotMixin,
volume.size * units.Gi,
is_file_max_size=False)
def _copy_volume_from_snapshot(self, snapshot, volume, volume_size):
def _copy_volume_from_snapshot(self, snapshot, volume, volume_size,
src_encryption_key_id=None,
new_encryption_key_id=None):
"""Copy data from snapshot to destination volume."""
if new_encryption_key_id:
msg = _("Encryption key %s was requested. Volume "
"encryption is not currently supported.")
raise exception.NotSupportedOperation(
message=msg % new_encryption_key_id)
LOG.debug("snapshot: %(snap)s, volume: %(vol)s, "
"volume_size: %(size)s",
{'snap': snapshot.id,