ONTAP Rest API Discussions

PowerShell Toolkit 9.12.1 - Issue with Invoke-NcSnapMirrorUpdate (wrong snapmirror updated)

MRoney
1,387 Views

I have a PowerShell script that worked with the PSTK version 9.8 but I am unable to get working with 9.12.1.  It appears that I am unable to properly call the Invoke-NcSnapMirror* commands.

 

In the code, I retrieve a list of all snapmirrors on two FAS systems and present the user with a grid to select one to work on.

After selection, I validate the snapmirror select and I am able to call Get-NcSnapMirror using the retrieved selection data to see the status of the snapmirror.

But when I use the same variables to perform any Invoke-NcSnapmirror command, it works on the wrong snapmirror.

I added -ONTAPI to the command and it works correctly.

 

Here is the relevant code that does not work:

Wr G "3) Get SnapMirror List and select replications to reverse..."; ""

$SML = Get-NcSnapMirror -Controller $apfas -ErrorAction stop| select SourceVserver, DestinationVserver, Status, IsHealthy, TransferSchedule, SourceLocation, DestinationLocation, MirrorState, NcController, Policy, PolicyType, Vserver | sort SourceLocation
$SML += Get-NcSnapMirror -Controller $fpfas -ErrorAction stop| select SourceVserver, DestinationVserver, Status, IsHealthy, TransferSchedule, SourceLocation, DestinationLocation, MirrorState, NcController, Policy, PolicyType, Vserver | sort SourceLocation

$GridArguments = @{
OutputMode = 'Single'
Title = 'Please select a SnapMirror replication to revserse and click OK'
}

$SnapMirror = $SML | Out-GridView @GridArguments
if ( $SnapMirror -ne $null ) {

Wr G "SnapMirror Selected:"
$SnapMirror | Format-List

if ( $SnapMirror.NcController.Name -eq $fpfas.Name) {
$DstCtrl = $fpfas
$SrcCtrl = $apfas
} else {
$DstCtrl = $apfas
$SrcCtrl = $fpfas
}

$DstLoc = $SnapMirror.DestinationLocation
if ( $DstLoc -eq $null ) { Write-Error 'Destination Location Not Found' -ErrorAction Stop}
$Schedule = $SnapMirror.TransferSchedule
#$DstSVM, $DstVol = $DstLoc -Split ":"

$SrcLoc = $SnapMirror.SourceLocation
if ( $SrcLoc -eq $null ) { Write-Error 'Source Location Not Found' -ErrorAction Stop}
#$SrcSVM, $SrcVol = $SrcLoc -split ":"

Wr G "";Wr G "Get Status of SnapMirror Selected:"
Get-NcSnapMirror -Controller $DstCtrl -Destination $DstLoc | Format-List -Property *

Invoke-NcSnapMirrorUpdate -Controller $DstCtrl -Destination $DstLoc -Source $SrcLoc -ErrorAction stop

 

 

To make the code work, I simply change the last command by adding "-ONTAPI" to it.

 

Am I doing something wrong with RESTAPI?

1 ACCEPTED SOLUTION

AmmarMhowwala
1,175 Views

Hello MRoney,

Thank you for bringing this issue to our attention. We have been able to replicate it on our end and we assure you that we will be addressing it promptly. Rest assured that we will have it fixed in the upcoming release version 9.13.

 

View solution in original post

1 REPLY 1

AmmarMhowwala
1,176 Views

Hello MRoney,

Thank you for bringing this issue to our attention. We have been able to replicate it on our end and we assure you that we will be addressing it promptly. Rest assured that we will have it fixed in the upcoming release version 9.13.

 

Public