diff --git a/manila/share/drivers/infinidat/infinibox.py b/manila/share/drivers/infinidat/infinibox.py index 303804da0f..9813d11d96 100644 --- a/manila/share/drivers/infinidat/infinibox.py +++ b/manila/share/drivers/infinidat/infinibox.py @@ -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 diff --git a/manila/tests/share/drivers/infinidat/test_infinidat.py b/manila/tests/share/drivers/infinidat/test_infinidat.py index 0376921525..b8cd6e03b4 100644 --- a/manila/tests/share/drivers/infinidat/test_infinidat.py +++ b/manila/tests/share/drivers/infinidat/test_infinidat.py @@ -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 diff --git a/releasenotes/notes/infinidat-delete-datasets-with-snapshots-4d18f8c197918606.yaml b/releasenotes/notes/infinidat-delete-datasets-with-snapshots-4d18f8c197918606.yaml new file mode 100644 index 0000000000..e1ffa0a250 --- /dev/null +++ b/releasenotes/notes/infinidat-delete-datasets-with-snapshots-4d18f8c197918606.yaml @@ -0,0 +1,4 @@ +--- +fixes: + - Fixed a failure in the INFINIDAT share driver which occurs while deleting + shares with externally created snapshots.