Ensures API microversion is greater than or equal to '2.69'

This patch checks for manila microversion when soft-deleting a share
and ensures the API microversion is greater than or equal to '2.69'

Change-Id: Id40c84808b3c91cda7d87556bf19a51ac6fd3ee2
This commit is contained in:
Franca Mgbogu 2022-08-17 15:32:49 +00:00
parent 28ae7f22b9
commit e93f3c24da
1 changed files with 7 additions and 1 deletions

View File

@ -348,7 +348,13 @@ class DeleteShare(command.Command):
if parsed_args.force:
share_client.shares.force_delete(share_obj)
if parsed_args.soft:
share_client.shares.soft_delete(share_obj)
if share_client.api_version >= api_versions.APIVersion(
'2.69'):
share_client.shares.soft_delete(share_obj)
else:
raise exceptions.CommandError(
"Soft Deleting shares is only "
"available with manila API version >= 2.69")
else:
share_client.shares.delete(share_obj,
share_group_id)