ONTAP Rest API Discussions

return_timeout

Daredia
1,401 Views

Posting on behalf of a customer..

 

Per instruction in the document (https://library.netapp.com/ecmdocs/ECMLP2862544/html/index.html#/storage/quota_rule_modify), a `return_timeout` can be specified for asynchronous options where ONTAP waits that length of time to see if the job completes. This seems not to work for us.  We always get an immediate response with a job id instead of waiting. Could you please help check and advice if we are doing as expected?

 

Sample:

Api = https://xxxname.yyycompany.com/api/storage/quota/rules/d8b6b371-7b35-11eb-93cf-00a0989bbd8f?return_timeout=30

Kwargs = {"space": {"hard_limit": '1073741824'}}

Call = http_request('patch', api, kwargs)

We will get response:

{u'job': {u'_links': {u'self': {u'href': u'/api/cluster/jobs/49fcfe2c-7c00-11eb-93cf-00a0989bbd8f'}}, u'uuid': u'49fcfe2c-7c00-11eb-93cf-00a0989bbd8f'}}

1 REPLY 1

RobertBlackhart
1,356 Views

I'm not sure what library the http_request() function is coming from, but is it possible that by passing kwargs it is overwriting your query parameters in the URL you are providing? Maybe try this instead:

api = https://xxxname.yyycompany.com/api/storage/quota/rules/d8b6b371-7b35-11eb-93cf-00a0989bbd8f
Kwargs = {"space": {"hard_limit": '1073741824'}, "return_timeout": 30}
Call = http_request('patch', api, kwargs)

Alternatively, if you are using Python are you aware of the netapp-ontap library? It may help you. Here is what the same operation would look like there: 

from netapp_ontap import HostConnection
from netapp_ontap.resources import QuotaRule

rule = QuotaRule(uuid="d8b6b371-7b35-11eb-93cf-00a0989bbd8f")
rule.space = {"hard_limit": 1073741824}
rule.patch()

By default, it always waits for jobs to finish (polls them until they do). You can see more information and examples in the docs.

Public