Image: Update Cluster Peers in action
Note i: The script was tested with ONTAP 9.0RC1
and the DataONTAP PowerShell ToolKit 4.0.0.231 (I’m not sure why I had to put a
dummy passphrase in the script, perhaps this “bug” is fixed in later versions.)
Note ii: Assumptions are that the same credentials
can login to all the involved clusters, IPSpace names are consistent...
The Script
## SOURCE CLUSTER ##
Import-Module DataONTAP
$cluster = Read-Host "Enter Cluster Name"
$username = Read-Host
"Enter Admin User "
$password = Read-Host
"Enter Password "
-AsSecureString
$credential = New-Object
System.Management.Automation.PsCredential($username,$password)
Connect-NcController
$cluster -Credential $credential
$Peers = Get-NcClusterPeer
$Query = Get-NcNetInterface
-Template
$Query.role =
"intercluster"
$IcInts = Get-NcNetInterface
-Query $Query
## INTERCLUSTER LIFS to
IPSPACES (I2I) ##
[System.Object]$I2I = @{}
[System.Array]$I2I.IPSs =
@()
$IcInts | Foreach{
[Int]$Unique = ($I2I.IPSs).count
[System.Array]$I2I.IPSs = ($I2I.IPSs +=
$_.ipspace) | Select-Object -Unique
If($Unique -ne
($I2I.IPSs).count){[System.Array]$I2I.($_.Ipspace) = @()}
$I2I.($_.Ipspace) += ($_.Address)
}
## PEER CLUSTERS ##
$Peers | Foreach{
Connect-NcController $_.ClusterName
-Credential $credential
[String]$IPspace = (Get-NcClusterPeer
-ClusterName $cluster).IpspaceName
[Void](Get-NcClusterPeer -ClusterName
$cluster | Set-NcClusterPeer -Address ($I2I.$IPspace) -Passphrase
"anything")
}
No comments:
Post a Comment
Note: only a member of this blog may post a comment.