The Latest Gartner® Magic Quadrant™Hyperconverged Infrastructure Software
Moderators: anton (staff), art (staff), Max (staff), Anatoly (staff)
Heartbeat does not induce any load, in its turn. It serves just for pinging.after reading everything it doesn't seem that you can have separate iSCSI and HB channels
Code: Select all
param($addr="10.69.0.32", $port=3261, $user="root", $password="starwind",
$addr2="10.69.0.31", $port2=$port, $user2=$user, $password2=$password,
#common
$initMethod="Clear",
$size=5960000,
$sectorSize=4096,
$failover=0,
# $bmpType=1,
# $bmpStrategy=0,
#primary node
$imagePath="My computer\J\SW\Storages",
$imageName="masterImg_SSD_1",
$createImage=$true,
$storageName="",
$targetAlias="targetha_SSD_1",
$autoSynch=$true,
$poolName="SSD",
$syncSessionCount=1,
$aluaOptimized=$true,
$cacheMode="none",
$cacheSize=0,
$syncInterface="#p2=172.30.20.3:3260,172.30.20.4:3260" -f $addr2,
$hbInterface="#p2=172.30.30.3:3260,172.30.30.4:3260" -f $addr2,
$createTarget=$true,
# $bmpFolderPath="",
#secondary node
$imagePath2="My computer\J\SW\Storages",
$imageName2="partnerImg_SSD_1",
$createImage2=$true,
$storageName2="",
$targetAlias2="partnerha_SSD_1",
$autoSynch2=$true,
$poolName2="SSD",
$syncSessionCount2=1,
$aluaOptimized2=$false,
$cacheMode2=$cacheMode,
$cacheSize2=$cacheSize,
$syncInterface2="#p1=172.30.20.1:3260,172.30.20.2:3260" -f $addr,
$hbInterface2="#p1=172.30.30.1:3260,172.30.30.2:3260" -f $addr,
$createTarget2=$true
# $bmpFolderPath2=""
)
Import-Module StarWindX
try
{
Enable-SWXLog
$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()
}