diff --git a/manila/share/drivers/netapp/dataontap/client/client_cmode.py b/manila/share/drivers/netapp/dataontap/client/client_cmode.py index 32443c2c00..57a18809a6 100644 --- a/manila/share/drivers/netapp/dataontap/client/client_cmode.py +++ b/manila/share/drivers/netapp/dataontap/client/client_cmode.py @@ -3551,8 +3551,19 @@ class NetAppCmodeClient(client_base.NetAppBaseClient): }, }, } - result = self.send_request('qos-policy-group-get-iter', api_args, - False) + + try: + result = self.send_request('qos-policy-group-get-iter', + api_args, + False) + except netapp_api.NaApiError as e: + if e.code == netapp_api.EAPINOTFOUND: + msg = _("Configured ONTAP login user cannot retrieve " + "QoS policies.") + LOG.error(msg) + raise exception.NetAppException(msg) + else: + raise if not self._has_records(result): msg = _("No QoS policy group found with name %s.") raise exception.NetAppException(msg % qos_policy_group_name) diff --git a/manila/tests/share/drivers/netapp/dataontap/client/test_client_cmode.py b/manila/tests/share/drivers/netapp/dataontap/client/test_client_cmode.py index d2ece0b1d7..46b1e44142 100644 --- a/manila/tests/share/drivers/netapp/dataontap/client/test_client_cmode.py +++ b/manila/tests/share/drivers/netapp/dataontap/client/test_client_cmode.py @@ -5922,6 +5922,24 @@ class NetAppClientCmodeTestCase(test.TestCase): self.assertIs(True, policy_exists) + def test_qos_policy_group_get_no_permissions_to_execute_zapi(self): + naapi_error = self._mock_api_error(code=netapp_api.EAPINOTFOUND, + message='13005:Unable to find API') + self.mock_object(self.client, 'send_request', naapi_error) + + self.assertRaises(exception.NetAppException, + self.client.qos_policy_group_get, + 'possibly-valid-qos-policy') + + def test_qos_policy_group_get_other_zapi_errors(self): + naapi_error = self._mock_api_error(code=netapp_api.EINTERNALERROR, + message='13114:Internal error') + self.mock_object(self.client, 'send_request', naapi_error) + + self.assertRaises(netapp_api.NaApiError, + self.client.qos_policy_group_get, + 'possibly-valid-qos-policy') + def test_qos_policy_group_get_none_found(self): no_records_response = netapp_api.NaElement(fake.NO_RECORDS_RESPONSE) self.mock_object(self.client, 'send_request', diff --git a/releasenotes/notes/bug-1765420-netapp-fix-delete-share-for-vsadmins-b5dc9e0224cb3ba2.yaml b/releasenotes/notes/bug-1765420-netapp-fix-delete-share-for-vsadmins-b5dc9e0224cb3ba2.yaml new file mode 100644 index 0000000000..2ef7b405b7 --- /dev/null +++ b/releasenotes/notes/bug-1765420-netapp-fix-delete-share-for-vsadmins-b5dc9e0224cb3ba2.yaml @@ -0,0 +1,4 @@ +--- +fixes: + - The `Launchpad bug 1765420 `_ + that affected the NetApp ONTAP driver during share deletion has been fixed.