marvin_keys
2 Bronze

How to "refresh" a snapshot using CLI?

Jump to solution

I need to create a set of commands for our AIX Sysadmins that will allow them to run scripts against an XIO array to refresh a snapshot on demand.  They do not want me to re-map/mask the snapshot devices every time.  They are fine with stopping the DB and unmounting the filesystems.  They did just fine with TimeFinder on Vmax so I have no trust issues with giving them an account on the XIO.  And before anyone suggests it, we are having issues getting Appsync running so I'm steering away from that.  Since they're unix guys they want a command, not a GUI solution.

I am not a fan of RESTful API.  I have plenty of other things to do and becoming a JSON programmer is not one of them.  The documentation for RESTFUL is awful.  The doc for XIO commands is awful.  There are no cookbooks.  There are no models.  

I'm told I can "refresh" an existing snap but I can't find any XMS CLI (or RESTFUL API) commands to "refresh".  Is this a single command?  Is it an operand of a command?  Is it a series of commands?  I'm lost.  Any help would be appreciated.  Thanks.

Tags (3)
1 Solution

Accepted Solutions
dynamox
6 Thallium

Re: How to "refresh" a snapshot using CLI?

Jump to solution

Solutions Enabler is the gold standard, no arguing there. Itzikr's page does have an example, scroll all the way to the bottom of the linked page.

View solution in original post

0 Kudos
37 Replies
Avi3
3 Zinc

Re: How to "refresh" a snapshot using CLI?

Jump to solution

If you are planning to build a script, the recommendation is to use RestAPI since we make sure that RestAPI is kept backward compatible going forward. There is no such guarantee for CLI.

In any case, you should be looking at ‘create snapshot and reassign’ command for the snapshot refresh operation. Snapshot refresh is a new feature that was added in XtremIO 4.0 release. You should reach out to your EMC account team to help understand how snapshot refresh works.

0 Kudos
dynamox
6 Thallium

Re: How to "refresh" a snapshot using CLI?

Jump to solution
0 Kudos
marvin_keys
2 Bronze

Re: How to "refresh" a snapshot using CLI?

Jump to solution

Itzikr's Blog is useless.  No use cases.  No commands.  No examples.  Just marketing crap.  Why are there no decent models or examples showing how to do what should be a relatively simple process?  Show me an example in GUI.  Show me one in XMCLI.  Show me an example using a shell script that doesn't need to jump through flaming hoops.  None to be found.  This is not TimeFinder.

dynamox
6 Thallium

Re: How to "refresh" a snapshot using CLI?

Jump to solution

Solutions Enabler is the gold standard, no arguing there. Itzikr's page does have an example, scroll all the way to the bottom of the linked page.

View solution in original post

0 Kudos
marvin_keys
2 Bronze

Re: How to "refresh" a snapshot using CLI?

Jump to solution

Unfortunately the snapshot refresh is not working.  I've tried the GUI, and CLI with the "reassign" option, and both methods  fail to refresh the snap from the CG and tanks the command with repeatable errors when you decline to save the backup.  It also insists on creating a newly randomly named snap that it remaps to the target host.  I need to refresh the target volumes/snaps with a copy from the source CG on demand.  I can't put randomly numbered snapshot names in a script and update it every time I run it.   At this point support L2 and L3 have seen the issue and are working on it. 

0 Kudos
marvin_keys
2 Bronze

Re: How to "refresh" a snapshot using CLI?

Jump to solution

This has now been acknowledged by EMC as a bug and is supposed to be addressed in the upcoming 4.0.2 patch release.  In the meantime the solution (using XMCLI) is to use the create-snapshot-and-reassign command WITHOUT the "no-backup" option, then do a shell-game rename of the current snapshot-set to "old", the new snap to "current", then delete the old volumes.  It works for my purposes.  Reply to this thread if you want a copy of the script posted.

0 Kudos
Avi3
3 Zinc

Re: How to "refresh" a snapshot using CLI?

Jump to solution

Both of those are known issues and are scheduled to be fixed in the next service pack. More specifically, we are fixing the issue where the command fails when you decline to save the backup snapshot. You should not have this issue though if you are refreshing the snapshot from a consistency group.

We are also making the refresh process convenient by not relying on the randomly generated name of the snapshot.

0 Kudos
TimGoodman
1 Copper

Re: How to "refresh" a snapshot using CLI?

Jump to solution

Marvin, could you post the script/commands that you are using to do the refresh?

Thanks

0 Kudos
marvin_keys
2 Bronze

Re: How to "refresh" a snapshot using CLI?

Jump to solution

The script is below.  The original script was written by Scott H. (EMC).  I jazzed it up a bit for my use.  The basic idea is a shell game of snap, rename, delete old stuff. Reply if questions...

#25Nov2015 MDK.

# The settings below will need to be modified

#

# XMS_USER - Username on the XMS. Needs ssh key-auth configured

# XMS_HOST - Hostname/IP of the XMS

# XIO_CLUSTER - Cluster name within XMS (use "show-clusters" command to determine it)

# CG      - Consistency Group to refresh FROM

# SNAPSET      - Snapshot Set to refresh TO.  Data in this SNAPSET will be  overwritten!

############################################

# Make sure they specified the required parms.

############################################

while getopts u:h:c:g:s: parms

do

  case $parms in

  u) XMS_USER=$OPTARG;;

  h) XMS_HOST=$OPTARG;;

  c) XIO_CLUSTER=$OPTARG;;

  g) CG=$OPTARG;;

  s) SNAPSET=$OPTARG;;

  esac

done

SHOW_USAGE () {

WHAT=$1

echo

echo "Error: $WHAT not specified."

echo

echo "Must specify format:"

echo

echo "$0 -u XMS_USER -h XMS_HOST -c XIO_Cluster -g ConsistencyGroup -s SnapShotSet"

echo

exit

}

FAIL () {

REASON=$*

echo

echo "$0 $REASON command failed with rc=$RC.  Cluster=$XIO_CLUSTER, CG=$CG, SnapSet=$SNAPSET"

echo

exit $RC

}

if [ -z "$XMS_USER" ]; then SHOW_USAGE XMS_USER; fi

if [ -z "$XMS_HOST" ]; then SHOW_USAGE XMS_HOST; fi

if [ -z "$XIO_CLUSTER" ]; then SHOW_USAGE XIO_CLUSTER; fi

if [ -z "$CG" ]; then SHOW_USAGE ConsistencyGroup; fi

if [ -z "$SNAPSET" ]; then SHOW_USAGE SNAPSET; fi

#echo XMS_USER is $XMS_USER

#echo XMS_HOST is $XMS_HOST

#echo XIO_CLUSTER is $XIO_CLUSTER

#echo CG is $CG

#echo SNAPSET is $SNAPSET

#######################################################

# Temporary Snapshot Set names used during refresh

#######################################################

SSNEW="${SNAPSET}"-new.`date '+%s'`

SSOLD="${SNAPSET}"-old.`date '+%s'`

#######################################################

# Refresh the snapshot set, WITHOUT the no-backup option

# NOTE: THIS IS NOT CREATING A NEW SNAPSHOT - IT IS REFRESHING IN PLACE!

#######################################################

ssh ${XMS_USER}@${XMS_HOST} create-snapshot-and-reassign cluster-id=\"${XIO_CLUSTER}\" from-consistency-group-id=\"${CG}\" to-snapshot-set-id=\"${SNAPSET}\"  snapshot-set-name=\"${SSNEW}\"

RC=$?

if [ ! $RC = 0 ]; then

  FAIL "create-snapshot-and-reassign"

fi

#######################################################

# Rename snapshot sets. Current becomes old, new becomes current

#######################################################

ssh ${XMS_USER}@${XMS_HOST} rename cluster-id=\"${XIO_CLUSTER}\" snapshot-set-id=\"${SNAPSET}\" new-name=\"${SSOLD}\"

RC=$?

if [ ! $RC = 0 ]; then FAIL "rename-1"; fi

ssh ${XMS_USER}@${XMS_HOST} rename cluster-id=\"${XIO_CLUSTER}\" snapshot-set-id=\"${SSNEW}\" new-name=\"${SNAPSET}\"

RC=$?

if [ ! $RC = 0 ]; then FAIL "rename-2"; fi

#################################################################################

# NOTE - At this point you can take the database out of backup mode.

#################################################################################

#######################################################

# Generate list of all volumes in the snapshot set

#######################################################

Vols=`ssh ${XMS_USER}@${XMS_HOST} show-snapshot-set cluster-id=\"${XIO_CLUSTER}\" ss-id=\"${SSOLD}\" | awk '/\tName: / { print $2 }'`

#######################################################

# Delete the old volumes one at a time

#######################################################

for volname in $Vols

do

  echo Deleting volume $volname

  ssh ${XMS_USER}@${XMS_HOST} remove-volume cluster-id=\"${XIO_CLUSTER}\" vol-id=\"${volname}\"

  RC=$?

  if [ ! $RC = 0 ]; then FAIL "delete of volume $volname"; fi

done

echo "Snapshot complete"

0 Kudos