From 0a721ddd3c1ed64265b3c3e77c1cf2cd2a87d88e Mon Sep 17 00:00:00 2001 From: Kiran Pawar Date: Fri, 24 Nov 2023 13:04:24 +0000 Subject: [PATCH] Fix prune deleted volumes for clones During prune deleted volumes option, if volume is offline, manila calls for ONTAP volume-destroy API. However if volume has one or more clones, the destroy operation fails. So upon receving clone related error, check clone spilt status and if not started, start it. --- .../share/drivers/netapp/dataontap/client/client_cmode.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/manila/share/drivers/netapp/dataontap/client/client_cmode.py b/manila/share/drivers/netapp/dataontap/client/client_cmode.py index 26b4b07ee7..dbcba14a1f 100644 --- a/manila/share/drivers/netapp/dataontap/client/client_cmode.py +++ b/manila/share/drivers/netapp/dataontap/client/client_cmode.py @@ -3963,9 +3963,14 @@ def prune_deleted_volumes(self): try: client.send_request( 'volume-destroy', {'name': volume_name}) - except netapp_api.NaApiError: + except netapp_api.NaApiError as e: LOG.error( 'Pruning soft-deleted volume %s failed', volume_name) + if e.code == netapp_api.EVOLDEL_NOT_ALLOW_BY_CLONE: + if self.volume_clone_split_status(volume_name) != 100: + self.volume_clone_split_start(volume_name) + LOG.debug('Starting clone split for ' + 'volume %s ', volume_name) @na_utils.trace def create_snapshot(self, volume_name, snapshot_name):