Ask The Experts

DP mirrored volumes to convert XDP

VivekTalluri

Hello community,
I would like to create a PowerShell script, which is DP mirrored volumes to convert to XDP
Anyone able to help me with some useful code?

1 ACCEPTED SOLUTION

donny_lang
#>

#Read-Host "Please provide the ONTAP Cluster you want to convert"
$Name = Read-Host -Prompt 'Please provide a cluster name'
$Creds = Get-Credential -Message 'provide password'
$ClusterObj = Connect-NcController -Name $Name -Credential $Creds

#Pull blank template
$DPQuery = Get-NcSnapmirror -Template 

#Adjust to filter for DP snapmirrors
$DPQuery.RelationshipType = 'data_protection'
$DPQuery.Policy = 'DPDefault'

#Query for DP relationships
$DPRelations = Get-NcSnapmirror -Query $DPQuery -NcController $ClusterObj

#Quiesces the snapmirror relationship
$DPRelations | Invoke-NcSnapmirrorQuiesce -NcController $ClusterObj

#Break the snapmirror relationship
$DPRelations | Invoke-NcSnapmirrorBreak -NcController $ClusterObj -Confirm:$false

#Set the destination volume to disable autodelete of snapshot(s)
$DPRelations | Set-NcSnapshotAutodelete -Volume {$_.DestinationVolume} -Key 'state' -value 'off' -NcController { Connect-NcController -Name $Name -Credential $Creds -Vserver $_.DestinationVserver } | out-null

#Removes / deletes the snapmirror relationship between the source and destination volume
$DPRelations | Remove-NcSnapmirror -NcController $ClusterObj -confirm:$false | out-null

#Create the snapmirror relationship between the source and destination volume
#This will use vault which is XDP, and mirror all snapshots like a normal DP snapmirror setup
$DPRelations | New-NcSnapmirror -Type 'vault' -NcController $ClusterObj -Policy 'MirrorAllSnapshots' | out-null

#Start snapmirror resync
$DPRelations | Invoke-NcSnapmirrorResync -NcController $ClusterObj | Select-Object -Property Status

#Set the destination volume to enable autodelete of snapshot(s)
$DPRelations | Set-NcSnapshotAutodelete -Volume {$_.DestinationVolume} -Key 'state' -value 'on' -NcController { Connect-NcController -Name $Name -Credential $Creds -Vserver $_.DestinationVserver } | out-null```

This code came from Reddit but I have used it with good results in the past.

View solution in original post

1 REPLY 1

donny_lang
#>

#Read-Host "Please provide the ONTAP Cluster you want to convert"
$Name = Read-Host -Prompt 'Please provide a cluster name'
$Creds = Get-Credential -Message 'provide password'
$ClusterObj = Connect-NcController -Name $Name -Credential $Creds

#Pull blank template
$DPQuery = Get-NcSnapmirror -Template 

#Adjust to filter for DP snapmirrors
$DPQuery.RelationshipType = 'data_protection'
$DPQuery.Policy = 'DPDefault'

#Query for DP relationships
$DPRelations = Get-NcSnapmirror -Query $DPQuery -NcController $ClusterObj

#Quiesces the snapmirror relationship
$DPRelations | Invoke-NcSnapmirrorQuiesce -NcController $ClusterObj

#Break the snapmirror relationship
$DPRelations | Invoke-NcSnapmirrorBreak -NcController $ClusterObj -Confirm:$false

#Set the destination volume to disable autodelete of snapshot(s)
$DPRelations | Set-NcSnapshotAutodelete -Volume {$_.DestinationVolume} -Key 'state' -value 'off' -NcController { Connect-NcController -Name $Name -Credential $Creds -Vserver $_.DestinationVserver } | out-null

#Removes / deletes the snapmirror relationship between the source and destination volume
$DPRelations | Remove-NcSnapmirror -NcController $ClusterObj -confirm:$false | out-null

#Create the snapmirror relationship between the source and destination volume
#This will use vault which is XDP, and mirror all snapshots like a normal DP snapmirror setup
$DPRelations | New-NcSnapmirror -Type 'vault' -NcController $ClusterObj -Policy 'MirrorAllSnapshots' | out-null

#Start snapmirror resync
$DPRelations | Invoke-NcSnapmirrorResync -NcController $ClusterObj | Select-Object -Property Status

#Set the destination volume to enable autodelete of snapshot(s)
$DPRelations | Set-NcSnapshotAutodelete -Volume {$_.DestinationVolume} -Key 'state' -value 'on' -NcController { Connect-NcController -Name $Name -Credential $Creds -Vserver $_.DestinationVserver } | out-null```

This code came from Reddit but I have used it with good results in the past.

View solution in original post

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