ok so :
172.16.0.21 sw-1 management
172.16.10.10 sw-1 data/heartbeat
172.16.20.10 sw-1 replication
172.16.0.22 sw-2 management
172.16.10.20 sw-2 data/heartbeat
172.16.20.20 sw-2 replication
script :
Code: Select all
param($addr="172.16.0.21", $port=3261, $user="root", $password="starwind",
$addr2="172.16.0.22", $port2=$port, $user2=$user, $password2=$password,
#common
$initMethod="NotSynchronize",
$size=5120,
$sectorSize=512,
$failover=0,
$bmpType=1,
$bmpStrategy=0,
#primary node
$imagePath="/mnt/sdb1/volume1",
$imageName="test1",
$createImage=$true,
$storageName="",
$targetAlias="test1",
$poolName="sdb1",
$syncSessionCount=1,
$aluaOptimized=$true,
$cacheMode="none",
$cacheSize=0,
$syncInterface="#p2={0}:3260" -f "172.16.20.20",
$hbInterface="#p2=172.16.10.20:3260",
$createTarget=$true,
$bmpFolderPath="",
#secondary node
$imagePath2="/mnt/sdb1/volume1",
$imageName2="test1",
$createImage2=$true,
$storageName2="",
$targetAlias2="test1",
$poolName2="sdb1",
$syncSessionCount2=1,
$aluaOptimized2=$false,
$cacheMode2=$cacheMode,
$cacheSize2=$cacheSize,
$syncInterface2="#p1={0}:3260" -f "172.16.20.10",
$hbInterface2="#p2=172.16.10.10:3260",
$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.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.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()
}
and error :
Request to 172.16.0.22 ( 172.16.0.22 ) : 3261
-
control HAImage -CreateHeader:"Headers\test1\test1_HA.swdsk" -pathDirHeaderBackup:"/mnt/sdb1/volume1" -file:"imagefile1" -size:"5120" -Prior
ity:"#p0=1;#p1=0" -nodeType:"#p0=1;#p1=1" -PartnerTargetName:"#p1=iqn.2008-08.com.starwindsoftware:172.16.0.21-test1" -PartnerIP:"#p1=172.16
.20.10:sync

1;#p2=172.16.10.10

3260:1" -IsAutoSynchEnabled:"0" -AuthChapLogin:"#p1=0b" -AuthChapPassword:"#p1=0b" -AuthMChapN
ame:"#p1=0b" -AuthMChapSecret:"#p1=0b" -AuthChapType:"#p1=none" -Offset:"0" -CacheMode:"none" -CacheSizeMB:"0" -serial:"4C1F0B83F6D6678C" -e
ui64:"4C1F0B83F6D6678C" -revision:"0001" -product:"STARWIND" -vendor:"STARWIND" -Replicator:"#p0=0" -WitnessType:"0" -AluaAccessState:"#p0=1
;#p1=0" -typeBitmapStore:"#p1=1"
-
200 Failed: invalid partner info.
lun test1 is created but gui reports :
LUN
test1
The replication partner is not synchronised
sw-1
LUN
test1
Failed to receive a heartbeat from the replication partner 'sw-2'
sw-1mnt
also behind that it was created with errors - i see it over text console on both nodes in path : /mnt/sdb1/volume1/test1.img
the iscsi links refers to ....management network address ;( :
iqn.2008-08.com.starwindsoftware:172.16.0.21-test1, iqn.2008-08.com.starwindsoftware:172.16.0.22-test1
another question is time server configuration (shared source ) ? there is no ntp or chrony installed ...