diff --git a/manila/share/drivers/netapp/dataontap/cluster_mode/lib_base.py b/manila/share/drivers/netapp/dataontap/cluster_mode/lib_base.py index 96a7a15d6d..1bd83d231b 100644 --- a/manila/share/drivers/netapp/dataontap/cluster_mode/lib_base.py +++ b/manila/share/drivers/netapp/dataontap/cluster_mode/lib_base.py @@ -4220,14 +4220,6 @@ def ensure_shares(self, context, shares): else: LOG.warning(msg) - try: - self._client.prune_deleted_nfs_export_policies() - self._client.prune_deleted_snapshots() - self._client.prune_deleted_volumes() - except Exception as e: - LOG.warning("Failed to cleanup resources in ensure share: " - "Error - %s", e.message) - return updates def ensure_share_server(self, context, share_server, network_info): diff --git a/manila/share/drivers/netapp/dataontap/cluster_mode/lib_multi_svm.py b/manila/share/drivers/netapp/dataontap/cluster_mode/lib_multi_svm.py index d0ea784a7e..e11ccc2d26 100644 --- a/manila/share/drivers/netapp/dataontap/cluster_mode/lib_multi_svm.py +++ b/manila/share/drivers/netapp/dataontap/cluster_mode/lib_multi_svm.py @@ -134,6 +134,9 @@ def _get_ems_pool_info(self): @na_utils.trace def _handle_housekeeping_tasks(self): """Handle various cleanup activities.""" + self._client.prune_deleted_nfs_export_policies() + self._client.prune_deleted_snapshots() + self._client.prune_deleted_volumes() self._client.remove_unused_qos_policy_groups() (super(NetAppCmodeMultiSVMFileStorageLibrary, self). diff --git a/manila/share/drivers/netapp/dataontap/cluster_mode/lib_single_svm.py b/manila/share/drivers/netapp/dataontap/cluster_mode/lib_single_svm.py index abbba7986c..84dfa539a8 100644 --- a/manila/share/drivers/netapp/dataontap/cluster_mode/lib_single_svm.py +++ b/manila/share/drivers/netapp/dataontap/cluster_mode/lib_single_svm.py @@ -118,9 +118,12 @@ def _get_ems_pool_info(self): @na_utils.trace def _handle_housekeeping_tasks(self): """Handle various cleanup activities.""" + vserver_client = self._get_api_client(vserver=self._vserver) + vserver_client.prune_deleted_nfs_export_policies() + vserver_client.prune_deleted_snapshots() + vserver_client.prune_deleted_volumes() if self._have_cluster_creds: - vserver_client = self._get_api_client(vserver=self._vserver) # Harvest soft-deleted QoS policy groups vserver_client.remove_unused_qos_policy_groups() diff --git a/manila/tests/share/drivers/netapp/dataontap/cluster_mode/test_lib_multi_svm.py b/manila/tests/share/drivers/netapp/dataontap/cluster_mode/test_lib_multi_svm.py index 3d3b9610f1..503284603a 100644 --- a/manila/tests/share/drivers/netapp/dataontap/cluster_mode/test_lib_multi_svm.py +++ b/manila/tests/share/drivers/netapp/dataontap/cluster_mode/test_lib_multi_svm.py @@ -392,13 +392,15 @@ def test__verify_share_server_name(self, vserver_exists, identifier): def test_handle_housekeeping_tasks(self): - self.mock_object(self.client, 'remove_unused_qos_policy_groups') + self.mock_object(self.client, 'prune_deleted_nfs_export_policies') + self.mock_object(self.client, 'prune_deleted_snapshots') mock_super = self.mock_object(lib_base.NetAppCmodeFileStorageLibrary, '_handle_housekeeping_tasks') self.library._handle_housekeeping_tasks() - self.assertTrue(self.client.remove_unused_qos_policy_groups.called) + self.assertTrue(self.client.prune_deleted_nfs_export_policies.called) + self.assertTrue(self.client.prune_deleted_snapshots.called) self.assertTrue(mock_super.called) def test_find_matching_aggregates(self): diff --git a/manila/tests/share/drivers/netapp/dataontap/cluster_mode/test_lib_single_svm.py b/manila/tests/share/drivers/netapp/dataontap/cluster_mode/test_lib_single_svm.py index 9958122022..695568c9fd 100644 --- a/manila/tests/share/drivers/netapp/dataontap/cluster_mode/test_lib_single_svm.py +++ b/manila/tests/share/drivers/netapp/dataontap/cluster_mode/test_lib_single_svm.py @@ -239,6 +239,9 @@ def test_handle_housekeeping_tasks_with_cluster_creds(self, have_creds): self.library._handle_housekeeping_tasks() + self.assertTrue( + mock_vserver_client.prune_deleted_nfs_export_policies.called) + self.assertTrue(mock_vserver_client.prune_deleted_snapshots.called) self.assertIs( have_creds, mock_vserver_client.remove_unused_qos_policy_groups.called)