Merge "VMware: Fix revert-to-snapshot"

This commit is contained in:
Zuul 2018-09-21 09:20:29 +00:00 committed by Gerrit Code Review
commit 8bd4ff7e6a
2 changed files with 3 additions and 3 deletions

View File

@ -3240,7 +3240,7 @@ class VMwareVcVmdkDriverTestCase(test.TestCase):
self._driver.revert_to_snapshot( self._driver.revert_to_snapshot(
mock.sentinel.context, volume, snapshot) mock.sentinel.context, volume, snapshot)
vops.get_backing.assert_called_once_with(volume.name) vops.get_backing.assert_called_once_with(volume.name, volume.id)
vops.revert_to_snapshot.assert_not_called() vops.revert_to_snapshot.assert_not_called()
@mock.patch.object(VMDK_DRIVER, 'volumeops') @mock.patch.object(VMDK_DRIVER, 'volumeops')
@ -3268,7 +3268,7 @@ class VMwareVcVmdkDriverTestCase(test.TestCase):
self._driver.revert_to_snapshot( self._driver.revert_to_snapshot(
mock.sentinel.context, volume, snapshot) mock.sentinel.context, volume, snapshot)
vops.get_backing.assert_called_once_with(volume.name) vops.get_backing.assert_called_once_with(volume.name, volume.id)
vops.revert_to_snapshot.assert_called_once_with(backing, vops.revert_to_snapshot.assert_called_once_with(backing,
snapshot.name) snapshot.name)

View File

@ -2218,7 +2218,7 @@ class VMwareVcVmdkDriver(driver.VolumeDriver):
raise exception.InvalidSnapshot("Cannot revert to template " raise exception.InvalidSnapshot("Cannot revert to template "
"based snapshot") "based snapshot")
backing = self.volumeops.get_backing(volume.name) backing = self.volumeops.get_backing(volume.name, volume.id)
if not backing: if not backing:
LOG.debug("Backing does not exist for volume.", resource=volume) LOG.debug("Backing does not exist for volume.", resource=volume)
else: else: