Microsoft Virtualization Discussions

Invoke-NcSnapMirrorBreak - Another SnapMirror operation is in progress.


I am trying to script the snapmirror failover process using PTK.


When I run the following set of commands,

# Update Existing SnapMirror and then Break it off
Invoke-NcSnapMirrorUpdate -Controller $DstCtrl -DestinationVserver $DstSVM -DestinationVolume $DstVol -ErrorAction stop
Watch-Command { Get-NcSnapMirror -Controller $DstCtrl -DestinationVserver $DstSVM -DestinationVolume $DstVol | Select Status } -Until "idle"
Invoke-NcSnapMirrorQuiesce -Controller $DstCtrl -DestinationVserver $DstSVM -DestinationVolume $DstVol -ErrorAction stop
Watch-Command { Get-NcSnapMirror -Controller $DstCtrl -DestinationVserver $DstSVM -DestinationVolume $DstVol | Select Status } -Until "quiesced"
Invoke-NcSnapMirrorBreak -Controller $DstCtrl -DestinationVserver $DstSVM -DestinationVolume $DstVol -Confirm:$false -ErrorAction stop


the Invoke-NcSnapMirrorBreak sometime returns with an error:

Invoke-NcSnapMirrorBreak : Another SnapMirror operation is in progress.
At Z:\Software\NetApp\Powershell Toolkit\Scripts\SnapMirror-Reverse-v3.ps1:119 char:1
+ Invoke-NcSnapMirrorBreak -Controller $DstCtrl -DestinationVserver $Ds ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (apfas8200:NcController) [Invoke-NcSnapmirrorBreak], EANOTHER_OP_ACTIVE
+ FullyQualifiedErrorId : ApiException,DataONTAP.C.PowerShell.SDK.Cmdlets.Snapmirror.InvokeNcSnapmirrorBreak


Why does it report another operation is in progress?  I just checked the status, and it was quiesced.

It does not fail every time it runs, just some of the time.  I have many snapmirrors where I perform this operation repeatedly.  Many work just fine and then others seem to fail nearly all the time.  I can sometimes just resume the snapmirror and start the script again and it runs without any issues on the same snapmirror.


Is there some code I can add to check and try again... like maybe 3 times before aborting?


Or better yet, does anyone know what I am not doing correctly to make sure the snapmirror is not performing another operation before I request the snapmirror break?



I'm not seeing anything wrong with the script. But adding a 3 second wait time following each watch-command may be helpful.


incorporating Python may help.


and I found the below on creating a time delay in Python.

I agree with aladd that adding a delay after the "Watch-Command" lines is good practice. Power shell has a built in command to add the delay. The scripts I see add 15-30 seconds.

Start-Sleep -s 15



Thank you for the feedback.  I am adding the delay and will let you know how that worked out.

NetApp on Discord Image

We're on Discord, are you?

Live Chat, Watch Parties, and More!

Explore Banner

Meet Explore, NetApp’s digital sales platform

Engage digitally throughout the sales process, from product discovery to configuration, and handle all your post-purchase needs.

NetApp Insights to Action
I2A Banner