Merge "NetApp ONTAP: Fix delete-share for vsadmin users" into stable/queens

This commit is contained in:
Zuul 2018-07-19 21:40:07 +00:00 committed by Gerrit Code Review
commit 9d93d1f1b6
3 changed files with 35 additions and 2 deletions

View File

@ -3669,8 +3669,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)

View File

@ -6222,6 +6222,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',

View File

@ -0,0 +1,4 @@
---
fixes:
- The `Launchpad bug 1765420 <https://bugs.launchpad.net/manila/+bug/1765420>`_
that affected the NetApp ONTAP driver during share deletion has been fixed.