Code: Select all
param($addr="192.168.100.6", $port=3261, $user="root", $password=starwind", $deviceName="HAImage4",
$addr2="192.168.100.9", $port2=$port, $user2=$user, $password2=$password,
#secondary node
$imagePath2="My computer\D",
$imageName2="imagefile4",
$createImage2=$true,
$targetAlias2="linuxstor",
$autoSynch2=$true,
$poolName2="pool1",
$syncSessionCount2=1,
$aluaOptimized2=$true,
$syncInterface2="#p1=10.10.10.8:3260" -f $addr,
$hbInterface2="#p2=192.168.100.9:3260",
$selfSyncInterface="#p1=10.10.10.6:3260," -f $addr2,
$selfHbInterface="#p2=192.168.100.6:3260"
)
Import-Module StarWindX
try
{
Enable-SWXLog -level SW_LOG_LEVEL_DEBUG
$server = New-SWServer $addr $port $user $password
$server.Connect()
$device = Get-Device $server -name $deviceName
if( !$device )
{
Write-Host "Device not found" -foreground red
return
}
$node = new-Object Node
$node.HostName = $addr2
$node.HostPort = $port2
$node.Login = $user2
$node.Password = $password2
$node.ImagePath = $imagePath2
$node.ImageName = $imageName2
$node.CreateImage = $createImage2
$node.TargetAlias = $targetAlias2
$node.SyncInterface = $syncInterface2
$node.HBInterface = $hbInterface2
$node.AutoSynch = $autoSynch2
$node.SyncSessionCount = $syncSessionCount2
$node.ALUAOptimized = $aluaOptimized2
$node.PoolName = $poolName2
Add-HAPartner $device $node $selfSyncInterface $selfHbInterface
}
catch
{
Write-Host $_ -foreground red
}
finally
{
$server.Disconnect()
}