Software Development Kit (SDK) and API Discussions

How to take Snapshot of a LUN through NetApp API's

prateek_sin
6,256 Views

Hi All,

         The problem I am facing has been mentioned below:

Problem:

         I am using Snapdrive For Linux 4.1.

         To create a snapshot of a lun I use the following command.

 

snapdrive snap create -lun <filer:lunname> -snapname <name of snapshot>

 

         The above command successfull creates the snapshot of a lun.

       

I want to take a snapshot of a lun through the netapp API's but I am unable to find the API that produces the exact output as the snapdrive command mentioed above.

The API 's i am currently using is Manage ONTAP SDK 3.0R for JAVA .

 

I would like to know can implement the above commant using an API ? If Yes Please tell the appropriate API that can be used ?

 

I have tried taking snapshot of a volume with the help of API's and it successfully created the snapshot.

 

Thanks 

6 REPLIES 6

aborzenkov
6,256 Views

There is no such thing as "snapshot of LUN" - you always take snapshot of a volume. Snapdrive just resolves volume name from LUN name and hides from you gory details. Additionally on Windows it makes filesystem sync; I am not sure whether it does it on Linux; AFAIK not.

So to create crash-consistent snapshot of a LUN just create snapshot of a volume containing this LUN.

prateek_sin
6,256 Views

Ok.

    Now I have taken the snapshot of the whole volume with the help of Manage ONTAP API.

Can you tell me how can I create a LUN from this snapshot copy.

There is an API called  lun-create-from-snapshot which takes the following inputs:

1. path                        <string>         the path of the LUN  (this is the path of the new lun that will be created after restore . Correct me if i am wrong)   

2. snapshot-lun-path     <string>        LUN path in the snapshot to be created from. (?)

the other 2 are optional inputs.

The statement ie marked in bold is not clear to me.

the following details might be useful

Filer name : Tolkien

volume name: /vol/test_zimbra

LUN name   : zimserver

name of the snapshot  : snap_from_api ( this is a snapshot of a volume).

nagendrk
6,256 Views

snapshot-lun-path is as shown in this example below:

C:\manage-ontap-sdk-3.5P1\bin\nt>apitest.exe <IP address>  <user>  <pwd>  lun-create-from-snapshot path /vol/voltest/lun3_from_lun2 snapshot-lun-path /vol/voltest/.snapshot/snap_for_lun_connect/lun2 space-reservation-enabled false
<results status="passed">
        <actual-size>74027520</actual-size>
</results>

In your case it would be: /vol/test_zimbra/.snapshot/snap_from_api/zimserver

saranraj456
6,256 Views

Hi,

If the volume contains n no.of .LUN's while taking a LUN snapshot with the help of snap drive does it take for entire volume or a specific LUN ?

Thnks

Saran

sens
6,256 Views

It takes the snapshot of the entire volume but only the LUN is crash-consistent.

When you execute a snap create operation for a LUN using snapdrive, it freezes I/O on the specific LUN before taking the snapshot of the volume where the LUN resides.

Thus if there are other LUNs or files (which may be connected or mounted to different hosts) present in the same volume, I/O on these entities are not frozen during snapshot creation.

aborzenkov
6,256 Views

snapshot is always volume based and includes everything on this volume.

Public