ONTAP Rest API Discussions

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

JRH0759

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

RobertBlackhart

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

Thank you Robert..

That worked for me..

RobertBlackhart

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

Announcements
Register for Insight 2021 Digital

INSIGHT 2021 Digital: Meet the Specialists 2

On October 20-22, gear up for a fully digital, totally immersive virtual experience with a downright legendary lineup of world-renowned specialists. Tune in for visionary conversations, solution deep dives, technical sessions and more.

NetApp on Discord Image

We're on Discord, are you?

Live Chat, Watch Parties, and More!

Explore Banner

Meet Explore, NetApp’s digital sales platform

Engage digitally throughout the sales process, from product discovery to configuration, and handle all your post-purchase needs.

NetApp Insights to Action
I2A Banner
Public