The transition to NetApp MS Azure AD B2C is complete. If you missed the pre-registration, you will be invited to reigister at next log in.
Please note that access to your NetApp data may take up to 1 hour.
To learn more, read the FAQ and watch the video.
Need assistance? Complete this form and select “Registration Issue” as the Feedback Category.

Active IQ Unified Manager Discussions

vFiler DR Resync via WFA

CHRISTIAN_UMREIN

Hi all,

I want to set up a "vFiler DR resync" command in WFA 2.0

Is there anyone who uses this already and could give me the command for this?

I want to write it in Power Shell.

Thanks,

Chris

1 ACCEPTED SOLUTION

yaronh

Hi Christian,

I was working with a team of advanced users from T-system on their workflows and happened to notice they've done some work on this. With permission of Paul Bloem and Carl Thijssen I am sharing their solution:

param (

    [parameter(Mandatory=$true, HelpMessage="Source array name or IP address")]

    [string]$SourceArray,

 

    [parameter(Mandatory=$true, HelpMessage="Destination array name or IP address")]

    [string]$DestinationArray, 

    [parameter(Mandatory=$true, HelpMessage="Source vFiler name")]

    [string]$SourceVFilerName,

    [parameter(Mandatory=$false, HelpMessage="Volume Name")]

    [string]$SourceVolumeName

)

# connect to controller

Connect-WFAController -Array $DestinationArray

#syntax:

#Invoke-NaVfilerDrResync [-RemoteVfiler] <String> [-RemoteFiler] <String> [-Credential <PSCredential>] [-Synchronous] [-Secure] [-Controller <NaController>] [-WhatIf] [-Confirm] [<CommonParameters>]

 

$cred = Get-NaCredentials -Host $SourceArray

if(!$cred)

{

    throw "Failed to get credentials for source array : " + $SourceArray

}

 

Get-WFALogger -Info -message $("Resync Vfiler DR")

$SourceBaseArray=$SourceArray.split(".")[0]

 

Get-WFALogger -Info -message $("Resync Vfiler DR " + $SourceVFilerName + " " + $SourceBaseArray + " " + $DestinationArray + " Cred:  " + $cred.UserName + " VolumeName " + $SourceVolumeName)

try

{

    Invoke-NaVfilerDrResync -RemoteVfiler $SourceVFilerName -RemoteFiler $SourceBaseArray -Secure -Credential $cred -Confirm:$false -ea Stop

}

catch

{

    $MyError=$_

    $FoundVolume=Get-NaVfilerDr -RemoteVfiler $SourceVFilerName -RemoteFiler $SourceBaseArray | where-object { $_.StoragePath -eq "$SourceVolumeName" }

    if ($FoundVolume)

    {

        Get-WFALogger -Info -message $("Found storage path " + $FoundVolume.StoragePath + " with status " + $FoundVolume.Status)

         if ($FoundVolume.Status -eq "initializing" -or $FoundVolume.Status -eq "snapmirrored")

        {

           Get-WFALogger -Info -message $("That is fantastic, apparently the resync worked")

        } else

        {

           Get-WFALogger -Info -message $("Not good, status is not good...")

           throw $MyError

        }

    } else

    {

       Get-WFALogger -Info -message $("Caught the exception, but throwing anyway")

       Get-NaVfilerDr -RemoteVfiler $SourceVFilerName -RemoteFiler $SourceBaseArray | Foreach-Object { Get-WFALogger -Info -message $("Volume " + $_.StoragePath + " Status " + $_.Status) }

       throw $MyError;

    }

}

Hope that helps as a base for building your command.

Cheers,

Yaron Haimsohn

WFA Team

View solution in original post

3 REPLIES 3

yaronh

Hi Christian,

I was working with a team of advanced users from T-system on their workflows and happened to notice they've done some work on this. With permission of Paul Bloem and Carl Thijssen I am sharing their solution:

param (

    [parameter(Mandatory=$true, HelpMessage="Source array name or IP address")]

    [string]$SourceArray,

 

    [parameter(Mandatory=$true, HelpMessage="Destination array name or IP address")]

    [string]$DestinationArray, 

    [parameter(Mandatory=$true, HelpMessage="Source vFiler name")]

    [string]$SourceVFilerName,

    [parameter(Mandatory=$false, HelpMessage="Volume Name")]

    [string]$SourceVolumeName

)

# connect to controller

Connect-WFAController -Array $DestinationArray

#syntax:

#Invoke-NaVfilerDrResync [-RemoteVfiler] <String> [-RemoteFiler] <String> [-Credential <PSCredential>] [-Synchronous] [-Secure] [-Controller <NaController>] [-WhatIf] [-Confirm] [<CommonParameters>]

 

$cred = Get-NaCredentials -Host $SourceArray

if(!$cred)

{

    throw "Failed to get credentials for source array : " + $SourceArray

}

 

Get-WFALogger -Info -message $("Resync Vfiler DR")

$SourceBaseArray=$SourceArray.split(".")[0]

 

Get-WFALogger -Info -message $("Resync Vfiler DR " + $SourceVFilerName + " " + $SourceBaseArray + " " + $DestinationArray + " Cred:  " + $cred.UserName + " VolumeName " + $SourceVolumeName)

try

{

    Invoke-NaVfilerDrResync -RemoteVfiler $SourceVFilerName -RemoteFiler $SourceBaseArray -Secure -Credential $cred -Confirm:$false -ea Stop

}

catch

{

    $MyError=$_

    $FoundVolume=Get-NaVfilerDr -RemoteVfiler $SourceVFilerName -RemoteFiler $SourceBaseArray | where-object { $_.StoragePath -eq "$SourceVolumeName" }

    if ($FoundVolume)

    {

        Get-WFALogger -Info -message $("Found storage path " + $FoundVolume.StoragePath + " with status " + $FoundVolume.Status)

         if ($FoundVolume.Status -eq "initializing" -or $FoundVolume.Status -eq "snapmirrored")

        {

           Get-WFALogger -Info -message $("That is fantastic, apparently the resync worked")

        } else

        {

           Get-WFALogger -Info -message $("Not good, status is not good...")

           throw $MyError

        }

    } else

    {

       Get-WFALogger -Info -message $("Caught the exception, but throwing anyway")

       Get-NaVfilerDr -RemoteVfiler $SourceVFilerName -RemoteFiler $SourceBaseArray | Foreach-Object { Get-WFALogger -Info -message $("Volume " + $_.StoragePath + " Status " + $_.Status) }

       throw $MyError;

    }

}

Hope that helps as a base for building your command.

Cheers,

Yaron Haimsohn

WFA Team

View solution in original post

CHRISTIAN_UMREIN

Hi Yaron,

the code works fine. Thank you

CHRISTIAN_UMREIN

Hi Yaron,

thanks for your source code.

I have implemented it and will start to test when our storage admins arrive.

Cheers,

Chris

Announcements
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
Public