ONTAP Rest API Discussions

REST API: How to mount a clone volume as NFS mount?

JRH0759
2,556 Views

HI,

I have figured out how to create a clone copy of an existing snapshot using the "create_clone.py" python script, but I have been unable to determine how to get created drive to show up as an available NFS mounted disk.
At the moment the only way I can do it, is if I go through the web GUI interface or through command line and mount the created volume and assign a path.

Is there a way to do this step via the API interface either using Linux curl command or using python??

 

TIA,

James

1 ACCEPTED SOLUTION
JRH0759 has accepted the solution

RobertBlackhart
2,508 Views

There's a full example in the nfs_setup.py script (https://github.com/NetApp/ontap-rest-python/blob/master/examples/rest_api/nfs_setup.py). But the part that would answer your question is that you need to send a PATCH request to the /api/storage/volumes/{uuid} endpoint for your volume and set the nas.path property. Here's an example using curl:

 

~/$ curl -ku admin -X PATCH -d '{"nas": {"path": "/my_files"}}' https://<cluster_mgmt>/api/storage/volumes/10a7fcdb-0746-11ec-bbfb-005056bb0536
Enter host password for user 'admin':
{
  "job": {
    "uuid": "65cc6310-097b-11ec-9580-005056bb0536",
    "_links": {
      "self": {
        "href": "/api/cluster/jobs/65cc6310-097b-11ec-9580-005056bb0536"
      }
    }
  }
}~/$
~/$ curl -ku admin https://<cluster_mgmt>/api/cluster/jobs/65cc6310-097b-11ec-9580-005056bb0536
Enter host password for user 'admin':
{
  "uuid": "65cc6310-097b-11ec-9580-005056bb0536",
  "description": "PATCH /api/storage/volumes/10a7fcdb-0746-11ec-bbfb-005056bb0536",
  "state": "success",
  "message": "success",
  "code": 0,
  "start_time": "2021-08-30T06:16:53-04:00",
  "end_time": "2021-08-30T06:16:54-04:00",
  "svm": {
    "name": "vs1",
    "uuid": "db390e8d-0435-11ec-a099-005056bb0536",
    "_links": {
      "self": {
        "href": "/api/svm/svms/db390e8d-0435-11ec-a099-005056bb0536"
      }
    }
  },
  "_links": {
    "self": {
      "href": "/api/cluster/jobs/65cc6310-097b-11ec-9580-005056bb0536"
    }
  }
}~/$

View solution in original post

2 REPLIES 2
JRH0759 has accepted the solution

RobertBlackhart
2,509 Views

There's a full example in the nfs_setup.py script (https://github.com/NetApp/ontap-rest-python/blob/master/examples/rest_api/nfs_setup.py). But the part that would answer your question is that you need to send a PATCH request to the /api/storage/volumes/{uuid} endpoint for your volume and set the nas.path property. Here's an example using curl:

 

~/$ curl -ku admin -X PATCH -d '{"nas": {"path": "/my_files"}}' https://<cluster_mgmt>/api/storage/volumes/10a7fcdb-0746-11ec-bbfb-005056bb0536
Enter host password for user 'admin':
{
  "job": {
    "uuid": "65cc6310-097b-11ec-9580-005056bb0536",
    "_links": {
      "self": {
        "href": "/api/cluster/jobs/65cc6310-097b-11ec-9580-005056bb0536"
      }
    }
  }
}~/$
~/$ curl -ku admin https://<cluster_mgmt>/api/cluster/jobs/65cc6310-097b-11ec-9580-005056bb0536
Enter host password for user 'admin':
{
  "uuid": "65cc6310-097b-11ec-9580-005056bb0536",
  "description": "PATCH /api/storage/volumes/10a7fcdb-0746-11ec-bbfb-005056bb0536",
  "state": "success",
  "message": "success",
  "code": 0,
  "start_time": "2021-08-30T06:16:53-04:00",
  "end_time": "2021-08-30T06:16:54-04:00",
  "svm": {
    "name": "vs1",
    "uuid": "db390e8d-0435-11ec-a099-005056bb0536",
    "_links": {
      "self": {
        "href": "/api/svm/svms/db390e8d-0435-11ec-a099-005056bb0536"
      }
    }
  },
  "_links": {
    "self": {
      "href": "/api/cluster/jobs/65cc6310-097b-11ec-9580-005056bb0536"
    }
  }
}~/$

JRH0759
2,505 Views

Thank you Robert..

That worked for me..

Public