Subscribe
Accepted Solution

WFA to abort all running snapmirrors

Hi all, Hope I can find help here configuring my first workflow.

 

In my network, I have many remote locations, been mirrored or vaulted to one SVM located in the center.

Due to WAN bandwitch and amount of data, there are always some mirrors still running on mornings.

I am trying to build, Or customize the built-in "abort snapmirror relationship" workflow. What I want to do is to let it run on the destination SVM- And Abort all running mirrors.

 

Problems I run into are:

If I configure the destination cluster and SVM, It will only "see" the first relationship I have, out of many.

If I configure it with Destination volume- How can I do it? Is there a way to use a wildcard search, or somehow configure it run on all relationships?

 

All clusters are at least 8.2.2 cDOT. no 8.3.X for now. 

WFA version 3.1P1

 

Thank you!!

 

Itay

 

 

Re: WFA to abort all running snapmirrors

[ Edited ]

Hi Blando,

 

Have you looked at using the 'repeat row' function and having the row repeat based on resources in a group?  It'll let you iterate through a set of commands for every member/row round using a filter or finder.  You could hardcode individual cluster/vserver names if you want - in the example below I'm using a user input variable instead.

 

wfa_repeat_row_3.1.PNG

 

 

I mocked up a quick workflow in WFA 3.1 that would iterate through each SnapMirror relationship and attached it to this thread.  I didn't have time today to actaully test it out today (the previews all look good), but it looks like it would do the trick on a per-vserver basis.  If you wanted to I'm sure you could nest this workflow in a separate workflow that iterates through a list of vservers.

 

It's worth noting I don't have access to any 8.2.X cDOT clusters right now and primarily use 8.3+; but could spin up some simulators in my home lab if you get stuck with something.

 

Let me know if you have any questions, happy to help.

Re: WFA to abort all running snapmirrors

Hi,

 

"Abort Snapmirror relationship" workflow supports volume level Snapmirror abort for single selected volume. You can use WFA row repetition option to select all the volume to run ‘Abort Snapmirror’.

Please refer the attached sample workflow to perform iteration of command.

 

Workflow name : Abort Snapmirror relationship_Test

Developed on :WFA 3.1

Re: WFA to abort all running snapmirrors

Hi Vinothini,

I import the DAR file to WFA. But I simply don't see it after that in Designer page.

Is it related to this message that I get? "The dar file contains NetApp certified content which is not signed by NetApp."

 

Thank you,

Itay

 

Re: WFA to abort all running snapmirrors

Hi Itay,

 

Please find the attached uncerficated sample workflow.

 

Regards,

Vinothini M.

Re: WFA to abort all running snapmirrors

Hi Joel,

Thanks for helping out here.

 

Your workflow looks like what I'm looking for. I have only 1 destination Vserver- So I either mark it or hard coded it later.

WHat I think doesn't work is this: Once the workflow identifies the first relationship that is not "transferring" , If fails the execution with error message:

"Failed to abort transfer for the relationship cluster://Vserver/dest_vol_name: No transfer to abort."

 

How can we force it to continue to the next one?

 

Thank you,

Blando

 

Re: WFA to abort all running snapmirrors

[ Edited ]

Hi Blando,

 

There is no way to do a force continuation to the next iteration (when one has failed due to some reason) other than command manipulation in WFA.

 

You can manipulate your command in interest, using the below APIs

  1. getWfaWorkflowParameter
  2. addWfaWorkflowParameter

Do not write flat eval/catch code rather use the output from the above APIs.

use strict;
use .....

my $Cluster;
my .......
my $ErrorIfUnsuccessful = 'true';
my $SkipIfPreviousError = 'false';
my $lunPreviousErrorCode = "0";
my $lunPreviousErrorReason;

GetOptions(
    "Cluster=s"             => \$Cluster,
    ......
) or die 'Illegal command parameters';

my $wfa_util = WFAUtil->new();

if ($SkipIfPreviousError eq 'true') {
    $lunPreviousErrorCode = $wfa_util->getWfaWorkflowParameter('lun_previous_error_code');
}
if ($lunPreviousErrorCode ne "0") {
    $wfa_util->sendLog('INFO', "Changing state of LUN $LunName has been skipped due to unsuccessful completion of previous step(s)");
    $lunPreviousErrorReason = $wfa_util->getWfaWorkflowParameter('lun_previous_error_reason');
    $wfa_util->sendLog('INFO', "Estimated previous error: $lunPreviousErrorReason");
}
else {
    eval {
        $wfa_util->sendLog('INFO', 'Connecting to cluster: ' . $Cluster);

        # DO SOMETHING ......

       $wfa_util->addWfaWorkflowParameter('lun_previous_error_code', 0, 0);
    };

    if ($ErrorIfUnsuccessful eq 'true') {
        $wfa_util->checkEvalFailure("Failed to change state (to $ChangeState) for LUN '$LunName'", $@);
    }
    else {
        if ($@) {
            my ($error_reason, $error_code) = $wfa_util->getEvalErrorReasonAndCode($@);
            $wfa_util->sendLog('ERROR', "Failed to change state (to $ChangeState) for LUN '$LunName': $error_reason ($error_code)");
            $wfa_util->addWfaWorkflowParameter('lun_previous_error_code', $error_code, 0);
            $wfa_util->addWfaWorkflowParameter('lun_previous_error_reason', $error_reason, 0);
        }
    }
}

This is an example of manupulation of code of our interest. This will also do skipping of further steps in one iteration upon failure in one step. At the same time you need to control the command instance in an intelegent way as well.

You can refer to the pack “Foreign LUN Import” from the store.

 

Thanks,

Gaurab

Re: WFA to abort all running snapmirrors

Hi,

OK, So I was working with the workflow I got from Joel.

I was able to pin point it to the destination Vserver. Also the way that I found in order to make it continue running even if it gets into relationship that is not "tranfrerring" was this:

In the "Abort SnapMirror command, at the end of it it shows:

 

...

$wfa_util->checkEvalFailure(
"Failed to abort transfer for the relationship $DestinationCluster://$DestinationVserver/$DestinationVolume",
$@

...

 

I removed the '$@' and it keeps on to the next relationship anyway. So it's good. But what does '$@' means anyway? Smiley Happy

 

ALso scheduled it, and it works great !

 

My first ever workflow :-)

 

Thanks!!

 

Re: WFA to abort all running snapmirrors

Forgot to ask this:

 

WHen I create a schedule, Is there a way to configure it to run on specific days of the week, like Mon-Fri only?

 

thank you!

 

Blando

 

Re: WFA to abort all running snapmirrors

Hi Blando,

 

It is a Perl special variable to catch error during eval execution (could be a syntax error as well).

When an eval finishes, you want to know whether it exited normally or whether it caught a fatal error. If the eval caught a fatal error, it returns undef and puts the error message in the $@ special variable, perhaps something like: Illegal division by zero.

 

Hope this helps.

 

Thanks,

Gaurab