Skip to content

Commit

Permalink
Revert "Move prune deletion tasks to ensure_shares."
Browse files Browse the repository at this point in the history
This reverts commit 36ed4a3.
  • Loading branch information
Carthaca committed Nov 22, 2024
1 parent a320250 commit cd8d58c
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit cd8d58c

Please sign in to comment.