INFINIDAT: support deleting datasets with snapshots
Deleting a share or a snapshot from the INFINDIAT InfiniBox should support a case where the share or snapshot has snapshots that were created externally (i.e. through the InfiniBox interface). Change-Id: Ic9d03493283c573506330a620fa21516bbd09c26 Closes-Bug: #1746439
This commit is contained in:
parent
a80c6fca57
commit
09da8f8d9d
@ -331,20 +331,12 @@ class InfiniboxShareDriver(driver.ShareDriver):
|
||||
"delete")
|
||||
LOG.warning(message, {"share": share})
|
||||
return # filesystem not found
|
||||
if infinidat_filesystem.has_children():
|
||||
# can't delete a filesystem that has a live snapshot
|
||||
if is_snapshot:
|
||||
raise exception.ShareSnapshotIsBusy(snapshot_name=dataset_name)
|
||||
else:
|
||||
reason = _("share has snapshots and cannot be deleted")
|
||||
raise exception.ShareBusyException(reason=reason)
|
||||
try:
|
||||
infinidat_export = self._get_export(infinidat_filesystem)
|
||||
except exception.ShareBackendException:
|
||||
# it's possible that the export has been deleted
|
||||
pass
|
||||
else:
|
||||
infinidat_export.safe_delete()
|
||||
except exception.ShareBackendException:
|
||||
# it is possible that the export has been deleted
|
||||
pass
|
||||
infinidat_filesystem.safe_delete()
|
||||
|
||||
@infinisdk_to_manila_exceptions
|
||||
|
@ -378,10 +378,12 @@ class InfiniboxDriverTestCase(InfiniboxDriverTestCaseBase):
|
||||
# should not raise an exception
|
||||
self.driver.delete_share(None, test_share)
|
||||
|
||||
def test_delete_share_with_children(self):
|
||||
def test_delete_share_with_snapshots(self):
|
||||
# deleting a share with snapshots should succeed:
|
||||
self._mock_filesystem.has_children.return_value = True
|
||||
self.assertRaises(exception.ShareBusyException,
|
||||
self.driver.delete_share, None, test_share)
|
||||
self.driver.delete_share(None, test_share)
|
||||
self._mock_filesystem.safe_delete.assert_called_once()
|
||||
self._mock_export.safe_delete.assert_called_once()
|
||||
|
||||
def test_delete_share_wrong_share_protocol(self):
|
||||
# set test_share protocol for non-NFS (CIFS, for that matter) and see
|
||||
@ -468,10 +470,12 @@ class InfiniboxDriverTestCase(InfiniboxDriverTestCaseBase):
|
||||
self._mock_filesystem.safe_delete.assert_called_once()
|
||||
self._mock_export.safe_delete.assert_called_once()
|
||||
|
||||
def test_delete_snapshot_with_children(self):
|
||||
def test_delete_snapshot_with_snapshots(self):
|
||||
# deleting a snapshot with snapshots should succeed:
|
||||
self._mock_filesystem.has_children.return_value = True
|
||||
self.assertRaises(exception.ShareSnapshotIsBusy,
|
||||
self.driver.delete_snapshot, None, test_snapshot)
|
||||
self.driver.delete_snapshot(None, test_snapshot)
|
||||
self._mock_filesystem.safe_delete.assert_called_once()
|
||||
self._mock_export.safe_delete.assert_called_once()
|
||||
|
||||
def test_delete_snapshot_doesnt_exist(self):
|
||||
self._system.filesystems.safe_get.return_value = None
|
||||
|
@ -0,0 +1,4 @@
|
||||
---
|
||||
fixes:
|
||||
- Fixed a failure in the INFINIDAT share driver which occurs while deleting
|
||||
shares with externally created snapshots.
|
Loading…
Reference in New Issue
Block a user