- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
You are correct, there is no snapmirror table in the WFA cm_storage database. I'd assume it will be included in a future release (although i'm not certain if or when this will be released).
For now we are limitied to using PowerShell within WFA commands using the CmdLet:
Get-NcSnapshot [[-Volume] <String[]>] [[-SnapName] <String[]>] [-Vserver <String[]>] [-Attributes <SnapshotInfo>] [-Controller <NcController[]>] [<CommonParameters>]
I recommend ensure an appropriate naming standard for you snapshots which enables you to easily determine which one to select (EG creating a snapshot by date). EG on the source your WFA command defines a naming prefix (by name) EG "flexclone" and suffix by date EG "2015-07-17" so your snapshot name is "flexclone.2015-07-17".
#'------------------------------------------------------------------------------
#'Check if the volume snapshot already exists on the source
#'------------------------------------------------------------------------------
[String]$SnapShotName = "$SnapShotPrefix.$SnapShotSuffix"
Try{
$snapShot = Get-NcSnapShot -Volume $VolumeName -SnapName $SnapShotName -Vserver $VserverName -ErrorAction Stop
}Catch{
Get-WFALogger -Error -Message $("Failed enumerating snapshot ""$SnapShotName"" on volume ""$VolumeName"" vserver ""$VserverName"". Error " + $_.Exception.Message)
Throw "Failed enumerating snapshot ""$SnapShotName"" on volume ""$VolumeName"" vserver ""$VserverName"""
}
If($snapShot){
Throw "The SnapShot ""$SnapShotName"" already exists on volume ""$VolumeName"" vserver ""$VserverName"""
}
#'------------------------------------------------------------------------------
#'Create the volume snapshot
#'------------------------------------------------------------------------------
Try{
New-NcSnapshot -Volume $VolumeName -Snapshot $SnapShotName -Comment $SnapShotComment -VserverContext $VserverName -ErrorAction Stop
Get-WFALogger -Info -Message "Created snapshot ""$SnapshotName"" on volume ""$VolumeName"" on vserver ""$VserverName"""
}Catch{
Get-WFALogger -Error -Message $("Failed creating SnapShot ""$SnapShotName"" on volume ""$VolumeName"" on vserver ""$VserverName"". Error " + $_.Exception.Message)
Throw "Failed creating SnapShot ""$SnapShotName"" on volume ""$VolumeName"" on vserver ""$VserverName"""
}
#'------------------------------------------------------------------------------
Once you've done a snapmirror update you can easily determine the parent snapshot name for the flexclone based on the date
#'------------------------------------------------------------------------------
#'Check if the parent snapshot exists
#'------------------------------------------------------------------------------
Try{
$snapShot = Get-NcSnapShot -Volume $VolumeName -SnapName $ParentSnapShot -Vserver $VserverName -ErrorAction Stop
Get-WFALogger -Info -Message "Enumerated snapshot ""$ParentSnapShot"" on volume ""$VolumeName"" vserver ""$VserverName"""
}Catch{
Get-WFALogger -Error -Message $("Failed enumerating snapshot ""$SnapShotName"" on volume ""$VolumeName"" vserver ""$VserverName"". Error " + $_.Exception.Message)
Throw "Failed enumerating snapshot ""$SnapShotName"" on volume ""$VolumeName"" vserver ""$VserverName"""
}
If(-Not($snapShot)){
Throw "The SnapShot ""$SnapShotName"" does not exists on volume ""$VolumeName"" vserver ""$VserverName"""
}
#'------------------------------------------------------------------------------
Here is an MVEL function that will get the date in ISO format. You call it like this:
getIsoDate(1)
#'------------------------------------------------------------------------------
def getIsoDate(date){
java.util.Calendar cal= java.util.Calendar.getInstance(java.util.Locale.getDefault()) ;
java.text.SimpleDateFormat format = new java.text.SimpleDateFormat("yyyy-MM-dd");
isoDate = format.format(cal.getTime());
return isoDate;
}
#'------------------------------------------------------------------------------
I hope a snapmirror table is included in a future WFA release too...it certainly would make workflow development much easier.
Anyway hop that gives you some ideas how to work around it.
/matt