Start a Conversation

Unsolved

This post is more than 5 years old

A

5 Practitioner

 • 

274.2K Posts

4652

September 23rd, 2015 14:00

Rest V2 Snapshot Create

In version 1 Rest API I could create a snapshot with a custom name doing the following:

POST https://xbrick-ip/api/json/types/snapshots/

{"ancestor-vol-id":"ttest11","snap-vol-name":"snap11"}

and it would create a snapshot with the name of snap11... 

I try to do the same thing in version 2 and cannot make it work..  I would think the following would work:

POST https://xbrick-ip/api/json/v2/types/snapshots/

{"from-volume-id":"ttest11","to-volume-id":"snap11a"}

When I run this I get the following:

{

  "message": "obj_not_found",

  "error_code": 400

}

I have tried multiple things from the 4.0 and 4.0.1 RESTful API guide, but have had no success.... Any Ideas?

5 Practitioner

 • 

274.2K Posts

September 28th, 2015 12:00

Hi,

Using "create-snapshot" commands in REST v2, you can't use the from-volume-id syntax or call.

it must be consistency groups as the go to, therefore, you must put volumes into CGs prior.

Here is my script:

#create the initial snaps

curl -k https://admin:Xtrem10@nblnxxms004c.net.inova.org/api/json/v2/types/snapshotsXtrem10@nblnxxms004c.net.inova.org/api/json/v2/types/snapshots

-d '{"cluster-id":"InovaBetaNok","consistency-group-id":"EPP_PRDSRC_CG","snapshot-set-name":"Snapshotset1","snap-suffix":".snap1","snapshot-type":"regular"}' -X POST

I had placed a bunch of volumes in the CG called EPP_PRDSRC_CG and then could run the command. Also, the guide states it as well..page 191 on the 4.0 REST guide.


Hope this helps...which now proves you cant merely take a snap of a volume unless you move it into a CG.

727 Posts

September 30th, 2015 13:00

Follow the instructions for creating snapshot (table 3 in the guide) and not for create snap and reassign (table 4 in the guide).

October 12th, 2015 15:00

hi Chris, if I try the snapshot request in the RESTClient in Firefox:

https://us-xtrem1/api/json/v2/types/snapshots/{"cluster-id":"us-xtrem1","consistency-group-id":"Test_BW"}

I get 400: Invalid request

Any idea why?

October 13th, 2015 09:00

Never mind,  I figured it out.

12 Posts

April 1st, 2016 10:00

@avi I do not see the syntax to refresh the snapshot in the RESTAPI for XIO guide.

Can you point me to the document and page number ?

33 Posts

April 1st, 2016 12:00

XtremIO RESTful API: https://support.emc.com/docu62759_XtremIO_4.0.2_Storage_Array_RESTful_API_Guide.pdf?language=en_US

Page 179 under section Create (POST) snapshots is table 3 for create snapshot and reassign. At a highlevel you are defining a TO and FROM (ex. Refresh volume 12 (TO) with content of volume 15 (FROM).

12 Posts

April 1st, 2016 17:00

Wow.Thanks.I never know that this guide existed.I was working off a 200 odd page doc that had nothing related refreshing a snapshot.Thanks

64 Posts

April 2nd, 2016 06:00

If you're working with Snapshots and the REST API you might find the following two URLs useful :

Using the XtremIO REST API (Part 3 in particular, but the other parts might be useful too)

XtremIO Snapshot Refresh

12 Posts

April 2nd, 2016 10:00

Hey Thanks.

I  actually have used these sites before.

727 Posts

April 2nd, 2016 10:00

Which document were you referring to?

5 Practitioner

 • 

274.2K Posts

February 9th, 2017 07:00

1. is there a way to   " map all the luns " from any Given SanpShotSet to a IG in single Rest API command  ?

collecting  all the LUNs from a snapshotset and then using  individual  LUN map is really painful . GUI  does thus one shot . so wondering if we have any API option for this .

2.  When  maping LUN ,  why can't we use "name" for mapping instead of system pciked name ( lun_IG_HLU ) ?

if we can name the maping , then it is easy to refer the name when doing un_map

Thanks

64 Posts

February 9th, 2017 10:00

1. LUN mapping is done one LUN at a time - there's no way to do it based on a snapshot set.  Whilst I agree this means some extra steps, these are steps that should be fairly trivial to automate, and given that the API is intended for programmatic use the additional overhead of doing it this way should be minimal.

2. LUN mappings don't have names as such - it's normally best to use the index (or even better, the "href" entry returned when querying them) rather than the "name" that is returned.

There are a few features that can probably make what you're doing much easier - in particular the "filter" and "full" options.

If you want to remove all mappings for a specific volume ("myvol1"), you can first do a query using a filter to find all LUN map entries that are relevant. eg :

/api/json/v2/types/lun-maps?filter=vol-name:eq:myvol1

The result of this query will be zero or more entries, each containing a "href" field.  You then just need to take those href fields, and DELETE them.

If you only wanted to unmap that volume from a single initiator group ("IG1"), then you could add an extra option to your filter to just look for mappings to that one IG :

/api/json/v2/types/lun-maps?filter=vol-name:eq:myvol1&filter=ig-name:eq:IG1

The "full" option isn't needed here, but can help if you want to add some extra logic in your code.  Normally when you query entries like those above you only get limited details back, and in order to get the full details for each returned entry you need to specifically ask for that one entry. (eg, a GET on it's href URL).  If you add the full=1 option to your URL, you'll get the full details for ALL of the entries returned - whether that's one entry (eg, if you're using filtering as well), or if it's every entry in the entire array.  This works for most commands, including things like volumes, snapshots, lun mappings, etc.

eg, to get the full LUN Mapping entry for all mappings between "myvol1" and "IG1", you could use :

/api/json/v2/types/lun-maps?filter=vol-name:eq:myvol1&filter=ig-name:eq:IG1&full=1

If you know you only want some of the full information, you can take it a step further and add one or more "prop=" options, which will only show those properties.  eg, say I wanted to return all volumes which were mapped to more than 2 initiator groups, and return just their size and the number of initiators they were mapped to (plus a few basics like name/index that are always returned) I could use :

/api/json/v2/types/volumes?filter=num-of-lun-mappings:gt:2&full=1&prop=num-of-lun-mappings&prop=vol-size

All of this is described in more details in the REST API guide, the current version of which is available at https://support.emc.com/docu71060_XtremIO-XIOS-4.0.2-and-4.0.4-and-4.0.10-and-4.0.15-with-XMS-4.2.0-and-4.2.1-Storage-Ar…

5 Practitioner

 • 

274.2K Posts

February 9th, 2017 22:00

Thanks Scott,

filter options is very useful.

when I list my snapshotset   to find out the LUN's associated with it,   not finding any common string I can use to filter.

See below.   it has only the disk name . no  common pattern in the same line or disk Vol ID .  or am I missing the right way to locate belongs to a SnapShotSet ?

"creation-time-long": "1486623109000",

        "guid": "63326d9104c84fe7b9e8f5b97bb02ddd",

        "vol-list": [

            [

                "edb92131ce44483a90e214edb7db5952",

                "DC1_Dirct_ucsLQAM3219_3TB.1486623109766",

                631

            ]

        ],

        "sys-id": [

            "af8381c964724ce0991f4fd59dd40618",

            "L4SE0123",

64 Posts

February 9th, 2017 22:00

The "vol-list" entry you've shown is the list of snapshots in the snapshot setup (XtremIO treats Snapshots and Volumes exactly the same, which is why this is referred to as 'vol-list' and not something like snap-list).

Each entry in this list will have 3 parts, being the GUID (the internal, unique reference for the volume), the volume name, and the volume ID).

For the example you've got there's only one volume. If you were trying to map this volume, you could use either the name ("DC1_Dirct_ucsLQAM3219_3TB.1486623109766") or the volume ID (631) as an argument to the 'vol-id' option to /api/json/v2/types/lun-maps  Of course, the snapshot set could have more than one volume, in which case you'd just loop over the entries in vol-list, mapping them one at a time.

Also keep in mind that mapping snapshots is normally only going to be a one-time operation. Once you've mapped them once, you can update the snapshot using a refresh operation - which does NOT need you to unmap the LUN first (although you do need to stop everything on the host from using it, otherwise it's going to be very unhappy when the data changes!). You can find more details on that at the 2 URLs listed in my previous post above.  Of course there are exceptions to this - it really depends on exactly what you're trying to achieve.

Hope that helps!

5 Practitioner

 • 

274.2K Posts

February 9th, 2017 22:00

Thanks Scot,

I am using unix curl .  so mainly depending   grep or similar to extract/filter  line that contain  disk label  .

any suggestion ?

No Events found!

Top