2 min read

XtremIO X2 Snapshots - REST API

(If you're not familiar with the XtremIO REST API I'd suggest first reading my posts on using it, in particular part 3 where I covered Snapshots)

I wrote previously about some of the changes to Snapshots in X2.

A number of corresponding changes were also made to the REST API, in particular from version 6.1 which introduced version 3 (/v3/) of the REST API.  In particular, a new 'command' concept was added for many snapshot operations, where operations like taking a new snapshot are now done as a PUT to the relevant /command/ URL, rather than as a POST on the snapshot object.

As previously, the REST API guide is still the best place to look for all available options, but be aware that there's 2 distinct API guides - one for API version 2.x, and a second for version 3.x.  In order to find the commands below - which are the ones you should be using on an X2 array - you'll need to look in the version 3.x guide.

Creating a Repurpose Copy

In the v2 API, creating a repurpose copy was done by making a POST operation against the snapshots object.  This changes in v3 to being a PUT operation against the  URI /api/json/v3/commands/consistency-groups/create-repurpose-copy. As previously, the details of what you want to take a copy of, new object names, etc, are all passed as options in the body of the request.

For example, to take a new snapshots of the Consistency Group "OracleProd", putting the new snapshots into a Linked Consistency Group called "OracleSnap1" we would use :

[scott ~]$ curl -X PUT -d '{"from-consistency-group-id":"OracleProd","new-consistency-group-name":"OracleSnap1"}' -u admin:Xtrem10 -k -s https://xms/api/json/v3/commands/consistency-groups/create-repurpose-copy

    "content": {
        "volumes": [
                "href": "https://xms/api/json/v3/types/volumes/75b5c5ec2e114e2d972ff7709826b97a",
                "index": 57,
                "guid": "75b5c5ec2e114e2d972ff7709826b97a",
                "name": "OracleProd1.1559727279785"
[...  trimmed ...]
        "consistency-group": {
            "href": "https://xms/api/json/v3/types/consistency-groups/02a8c28800d44f63990e97d63c3f9d80",
            "index": 1,
            "guid": "02a8c28800d44f63990e97d63c3f9d80",
            "name": "OracleSnap1"

The response includes details of both the Linked Consistency Group that is created, as well as entries for each of the new snapshot volume(s) created by the operation.

Creating a Protection Copy

Taking a Protection Copy (a read-only snapshot) is fundamentally the same as the above only using a different URI - /api/json/v3/commands/consistency-groups/create-protection-copy

Refreshing a Consistency Group

Refreshing a CG (or Linked CG), either from another CG or from a Snapshots Set, uses a PUT request to the URI /api/json/v3/commands/consistency-groups/refresh-data, once again as a PUT request with the relevant options passed in as the request body.

eg, to refresh the Linked CG we created above, we would use :

[scott ~]$ curl -X PUT -d '{"from-consistency-group-id":"OracleProd","to-consistency-group-id":"OracleSnap1","no-backup":"true"}' -u admin:Xtrem10 -k -s https://xms/api/json/v3/commands/consistency-groups/refresh-data
[scott ~]$

Note that this time there is no response - the fact that the query completes successfully is our indication that the refresh completed.

Other Operations

Other operations, such as adding volumes to a Consistency Group, are similar.  The details of the command URLs for these are all covered in the REST API guide.