ONTAP Rest API Discussions

REST API: Error when PATCHing volume comment

pbolin
3,482 Views

We are testing some functionality in the new REST API, and I have been having issues with updating volume comments on a couple filers. Filers I have tested on are running:
NetApp Release 9.7P11D1: Wed Jan 27 17:40:19 UTC 2021
NetApp Release 9.7P8: Thu Oct 15 04:11:57 UTC 2020
NetApp Release 9.8P4: Mon May 03 09:22:00 UTC 2021

I suspect there is some issue with the job control in some way, but I have not been able to verify. Have poked around in logs in systemshell as well as checked 'job history show' for any clues. I submitted a case to Support and they suggested I ask here.

 

The program I am using to do the updates:
import netapp_ontap
from netapp_ontap import config, HostConnection, NetAppRestError, utils
from netapp_ontap.resources import Svm, Volume, Aggregate, VolumeMetrics, Cluster, Node, CLI
from pprint import pprint as pp
import logging
logger = logging.getLogger()
logger.setLevel(logging.DEBUG)
ch = logging.StreamHandler()
ch.setLevel(logging.DEBUG)
logger.addHandler(ch)

utils.DEBUG = 1
utils.LOG_ALL_API_CALLS = 1

naauth = {'username': <USER> , 'password': <PASS>}

admin = <FILER>
with HostConnection(admin, verify=False, **naauth):
netapp_ontap.host_connection._HOST_CONTEXT.port=<PORT>
resource = Volume(uuid='dbdccb94-c936-11eb-b0cb-00a098ce3ae6')
resource.comment = "testingacomment"
result = resource.patch()
if result.is_err:
logger.error(f"Volume Comment Update Failed - {result.http_response.status_code} - {result.http_response.reason}")

 

The Responses from the API:
-----------REQUEST-----------
PATCH https://[filer]:[port]/api/storage/volumes/dbdccb94-c936-11eb-b0cb-00a098ce3ae6
User-Agent: python-requests/2.26.0
Accept-Encoding: gzip, deflate
Accept: */*
Connection: keep-alive
X-Dot-Client-App: netapp-ontap-python-9.9.1.0
Content-Type: application/json
Content-Length: 30
b'{"comment": "testingacomment"}'
-----------------------------

-----------RESPONSE-----------
202 Accepted
Date: Tue, 07 Sep 2021 16:22:57 GMT
Server: libzapid-httpd
X-Content-Type-Options: nosniff
Cache-Control: no-cache,no-store,must-revalidate
Content-Length: 189
Content-Type: application/hal+json
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
{
"job": {
"uuid": "dccd0527-0ff7-11ec-bbe3-00a098ef3e3a",
"_links": {
"self": {
"href": "/api/cluster/jobs/dccd0527-0ff7-11ec-bbe3-00a098ef3e3a"
}
}
}
}
------------------------------
https://[filer]:[port] "GET /api/cluster/jobs/dccd0527-0ff7-11ec-bbe3-00a098ef3e3a?fields=message%2Cstate HTTP/1.1" 200 220

-----------REQUEST-----------
GET https://[filer]:[port]/api/cluster/jobs/dccd0527-0ff7-11ec-bbe3-00a098ef3e3a?fields=message%2Cstate
User-Agent: python-requests/2.26.0
Accept-Encoding: gzip, deflate
Accept: */*
Connection: keep-alive
X-Dot-Client-App: netapp-ontap-python-9.9.1.0
None
-----------------------------

-----------RESPONSE-----------
200 OK
Date: Tue, 07 Sep 2021 16:22:58 GMT
Server: libzapid-httpd
X-Content-Type-Options: nosniff
Cache-Control: no-cache,no-store,must-revalidate
Content-Length: 220
Content-Type: application/hal+json
Keep-Alive: timeout=5, max=99
Connection: Keep-Alive
{
"uuid": "dccd0527-0ff7-11ec-bbe3-00a098ef3e3a",
"state": "failure",
"message": "entry doesn't exist",
"_links": {
"self": {
"href": "/api/cluster/jobs/dccd0527-0ff7-11ec-bbe3-00a098ef3e3a"
}
}
}
------------------------------
Job (failure): entry doesn't exist. Timeout remaining: 30.

3 REPLIES 3

JohnChampion
3,378 Views

Actually a better place to ask REST API questions is on Slack in the Netapp API channel.  Go to netapp.io and click on the Slack icon at top-right.  Post your question in the #api channel and you should get a response fairly quick.

LaurentN
3,041 Views

The issue is that a volume has 2 UUIDs: uuid and instance_uuid.   The uuid was initially accepted, but the job reported a failure as described above.  When switching to the instance_uuid, the call succeeded.

peterjumper
2,118 Views

^^^This^^^ is a hot tip!
Basically, anywhere the REST API asks for a volume UUID, it wants the instance_uuid.  In my case it was the storage/file/clone API.  Spent a solid 2 hours beating on this, getting

{
    "error": {
        "message": "entry doesn't exist",
        "code": "4",
        "target": "destination_path"
      }
  }

Man, that error is misleading.  dest path isn't the issue - it's the wrong vol UUID.

I searched docs and community pages, and finally stumbled on this thread.

Thanks!

Peter

(ex-NetApp)

Public