Below is the script configuration options I am using, if you could please help me out with this or point me in the direction of the correct documentation because I was unsuccessful trying to locate it. Appreciate any and all help and thanks for your help.
Code: Select all
param($addr="10.4.30.3", $port=3261, $user="root", $password="starwind",
$addr2="10.4.30.4", $port2=$port, $user2=$user, $password2=$password,
#common
$initMethod="Clear",
$size=100000,
$sectorSize=512,
$failover=0,
$bmpType=2,
$bmpStrategy=1,
#primary node
$imagePath="/mnt/sdb1/vol01",
$imageName="testha02",
$createImage=$true,
$storageName="",
$targetAlias="target02",
$autoSynch=$true,
$poolName="pool1",
$syncSessionCount=1,
$aluaOptimized=$true,
$cacheMode="none",
$cacheSize=0,
$syncInterface="#p2={0}:3260" -f "10.4.35.2",
$hbInterface="#p2={0}:3260" -f "10.4.32.11",
$createTarget=$true,
$bmpFolderPath="/mnt/md0/nvmevol01",
#secondary node
$imagePath2="/mnt/sdb1/vol02",
$imageName2="testha02",
$createImage2=$true,
$storageName2="",
$targetAlias2="target02",
$autoSynch2=$true,
$poolName2="pool1",
$syncSessionCount2=1,
$aluaOptimized2=$false,
$cacheMode2=$cacheMode,
$cacheSize2=$cacheSize,
$syncInterface2="#p1={0}:3260" -f "10.4.35.1",
$hbInterface2="#p1={0}:3260" -f "10.4.32.10",
$createTarget2=$true,
$bmpFolderPath2="/mnt/md0/nvmevol02"
)
Import-Module StarWindX
try
{
Enable-SWXLog -level SW_LOG_LEVEL_DEBUG
$server = New-SWServer -host $addr -port $port -user $user -password $password
$server.Connect()
$firstNode = new-Object Node
$firstNode.HostName = $addr
$firstNode.HostPort = $port
$firstNode.Login = $user
$firstNode.Password = $password
$firstNode.ImagePath = $imagePath
$firstNode.ImageName = $imageName
$firstNode.Size = $size
$firstNode.CreateImage = $createImage
$firstNode.StorageName = $storageName
$firstNode.TargetAlias = $targetAlias
$firstNode.AutoSynch = $autoSynch
$firstNode.SyncInterface = $syncInterface
$firstNode.HBInterface = $hbInterface
$firstNode.PoolName = $poolName
$firstNode.SyncSessionCount = $syncSessionCount
$firstNode.ALUAOptimized = $aluaOptimized
$firstNode.CacheMode = $cacheMode
$firstNode.CacheSize = $cacheSize
$firstNode.FailoverStrategy = $failover
$firstNode.CreateTarget = $createTarget
$firstNode.BitmapStoreType = $bmpType
$firstNode.BitmapStrategy = $bmpStrategy
$firstNode.BitmapFolderPath = $bmpFolderPath
#
# device sector size. Possible values: 512 or 4096(May be incompatible with some clients!) bytes.
#
$firstNode.SectorSize = $sectorSize
$secondNode = new-Object Node
$secondNode.HostName = $addr2
$secondNode.HostPort = $port2
$secondNode.Login = $user2
$secondNode.Password = $password2
$secondNode.ImagePath = $imagePath2
$secondNode.ImageName = $imageName2
$secondNode.CreateImage = $createImage2
$secondNode.StorageName = $storageName2
$secondNode.TargetAlias = $targetAlias2
$secondNode.AutoSynch = $autoSynch2
$secondNode.SyncInterface = $syncInterface2
$secondNode.HBInterface = $hbInterface2
$secondNode.SyncSessionCount = $syncSessionCount2
$secondNode.ALUAOptimized = $aluaOptimized2
$secondNode.CacheMode = $cacheMode2
$secondNode.CacheSize = $cacheSize2
$secondNode.FailoverStrategy = $failover
$secondNode.CreateTarget = $createTarget2
$secondNode.BitmapFolderPath = $bmpFolderPath2
$device = Add-HADevice -server $server -firstNode $firstNode -secondNode $secondNode -initMethod $initMethod
while ($device.SyncStatus -ne [SwHaSyncStatus]::SW_HA_SYNC_STATUS_SYNC)
{
$syncPercent = $device.GetPropertyValue("ha_synch_percent")
Write-Host "Synchronizing: $($syncPercent)%" -foreground yellow
Start-Sleep -m 2000
$device.Refresh()
}
}
catch
{
Write-Host $_ -foreground red
}
finally
{
$server.Disconnect()
}