The Latest Gartner® Magic Quadrant™Hyperconverged Infrastructure Software
Moderators: anton (staff), art (staff), Max (staff), Anatoly (staff)
Code: Select all
#common
$initMethod="SyncFromFirst",
$size=2048,
$sectorSize=512,
$failover=0,
$bmpType=1,
$bmpStrategy=0,
Code: Select all
2 node HA with free vsan
= Node 1 = = Node 2 =
Mgnt nic (172.31.10.23) <----- ---> Mgnt nic (172.31.10.24)
hb nic (10.10.6.23) <-----direct link ----> hb nic (10.10.6.24)
Sync nic (10.10.7.23) <-----direct link----> Sync nic (10.10.7.24)
Code: Select all
param($addr="172.31.10.23", $port=3261, $user="root", $password="starwind",
$addr2="172.31.10.24", $port2=$port, $user2=$user, $password2=$password,
#common
$initMethod="Clear",
$size=1200,
$sectorSize=512,
$failover=0,
#primary node
$imagePath="\mnt\disk1",
$imageName="mImg21",
$createImage=$true,
$storageName="",
$targetAlias="Mtha21",
$autoSynch=$true,
$poolName="pool1",
$syncSessionCount=1,
$aluaOptimized=$true,
$cacheMode="wb",
$cacheSize=128,
$syncInterface="#p2=10.10.7.24:3260" -f $addr2,
$hbInterface="#p2=10.10.6.24:3260,172.31.10.24:3260" -f $addr2,
$createTarget=$true,
#secondary node
$imagePath2="\mnt\disk1",
$imageName2="SlaImg22",
$createImage2=$true,
$storageName2="",
$targetAlias2="partnerha22",
$autoSynch2=$true,
$poolName2="pool1",
$syncSessionCount2=1,
$aluaOptimized2=$true,
$cacheMode2=$cacheMode,
$cacheSize2=$cacheSize,
$syncInterface2="#p1=10.10.7.23:3260" -f $addr,
$hbInterface2="#p1=10.10.6.23:3260,172.31.10.23:3260" -f $addr,
$createTarget2=$true
)
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
write-host "hola"
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()
}
Code: Select all
param($addr="172.31.10.23", $port=3261, $user="root", $password="starwind",
$addr2="172.31.10.24", $port2=$port, $user2=$user, $password2=$password,
#common
$initMethod="SyncFromFirst",
$size=2048,
$sectorSize=512,
$failover=0,
$bmpType=1,
$bmpStrategy=0,
#primary node
$imagePath="\mnt\disk1",
$imageName="masterImg21",
$createImage=$true,
$storageName="",
$targetAlias="starwind1",
$autoSynch=$true,
$poolName="pool1",
$syncSessionCount=1,
$aluaOptimized=$true,
$cacheMode="wb",
$cacheSize=128,
$syncInterface="#p2=10.10.7.24:3260" -f $addr2,
$hbInterface="#p2=10.10.6.24:3260,172.31.10.24:3260" -f $addr2,
$createTarget=$true,
$bmpFolderPath="",
#secondary node
$imagePath2="\mnt\disk1",
$imageName2="partnerImg22",
$createImage2=$true,
$storageName2="",
$targetAlias2="starwind2",
$autoSynch2=$true,
$poolName2="pool1",
$syncSessionCount2=1,
$aluaOptimized2=$true,
$cacheMode2=$cacheMode,
$cacheSize2=$cacheSize,
$syncInterface2="#p1=10.10.7.23:3260" -f $addr,
$hbInterface2="#p1=10.10.6.23:3260,172.31.10.23:3260" -f $addr,
$createTarget2=$true,
$bmpFolderPath2=""
)
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()
}
Code: Select all
PS C:\Users\Administrator> C:\Users\Administrator\Desktop\CreateHA_2.ps1
Request to 172.31.10.23 ( 172.31.10.23 ) : 3261
-
control ImageFile -CreateImage:"\mnt\disk1\mImg21.img" -Size:"12" -Flat:"True" -DeferredInit:"True" -Password:"starwind"
-
200 Failed: operation cannot be completed..
Code: Select all
Request to 172.31.10.23 ( 172.31.10.23 ) : 3261
-
control ImageFile -CreateImage:"VSA Storage\mnt\disk1\masterImg21.img" -Size:"5000" -Flat:"True" -DeferredInit:"True" -Password:"starwind"
-
200 Failed: operation cannot be completed..
At C:\Windows\system32\WindowsPowerShell\v1.0\Modules\StarWindX\HA.ps1:134 char:2
+ $server.CreateDevice($firstNode.ImagePath, $firstNode.ImageName, ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: (:) [], COMException
+ FullyQualifiedErrorId : System.Runtime.InteropServices.COMException
You cannot call a method on a null-valued expression.
The script has a blank field.You cannot call a method on a null-valued expression.
comes from the while ($device.SyncStatus -ne [SwHaSyncStatus]::SW_HA_SYNC_STATUS_SYNC), when changing the try place, $device is null.You cannot call a method on a null-valued expression.
Code: Select all
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()
}
Code: Select all
Request to 172.31.10.23 ( 172.31.10.23 ) : 3261
-
control ImageFile -CreateImage:"VSA Storage\mnt\disk1\masterImg21.img" -Size:"5000" -Flat:"True" -DeferredInit:"True" -Password:"starwind"
-
200 Failed: operation cannot be completed..
At C:\Windows\system32\WindowsPowerShell\v1.0\Modules\StarWindX\HA.ps1:134 char:2
+ $server.CreateDevice($firstNode.ImagePath, $firstNode.ImageName, ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: (:) [], COMException
+ FullyQualifiedErrorId : System.Runtime.InteropServices.COMException
Code: Select all
param
(
$addr="172.31.10.23", $port=3261, $user="root", $password="starwind",
$addr2="172.31.10.24", $port2=$port, $user2=$user, $password2=$password,
#common
$initMethod="SyncFromFirst",
$size=5000,
$sectorSize=512,
$failover=0,
#primary node
$imagePath="VSA Storage\mnt\DISK01",
$imageName="disk01image",
$createImage=$true,
$storageName="",
$targetAlias="disk01target",
$autoSynch=$true,
$poolName="disk01pool",
$syncSessionCount=1,
$aluaOptimized=$true,
$cacheMode="wb",
$cacheSize=128,
$syncInterface="#p2=10.10.7.24:3260" -f $addr2,
$hbInterface="#p2=10.10.6.24:3260,172.31.10.24:3260" -f $addr2,
$createTarget=$true,
#secondary node
$imagePath2="VSA Storage\mnt\DISK01",
$imageName2="disk01image",
$createImage2=$true,
$storageName2="",
$targetAlias2="disk01target",
$autoSynch2=$true,
$poolName2="disk01pool",
$syncSessionCount2=1,
$aluaOptimized2=$true,
$cacheMode2=$cacheMode,
$cacheSize2=$cacheSize,
$syncInterface2="#p1=10.10.7.23:3260" -f $addr,
$hbInterface2="#p1=172.31.10.23:3260,10.10.6.23:3260" -f $addr,
$createTarget2=$true
)
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
#
# 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
$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()
}
Code: Select all
Request to 172.31.10.23 ( 172.31.10.23 ) : 3261
-
control HAImage -CreateHeader:"" -DeviceHeaderPath:"VSA Storage\mnt\DISK01\disk01image_HA.swdsk" -Type:"ImageFile_HA" -file:"imagefile13" -size:"5000" -Priority:"#p0=0;#p1
=1" -nodeType:"#p0=1;#p1=1" -PartnerTargetName:"#p1=iqn.2008-08.com.starwindsoftware:172.31.10.24-disk01target" -PartnerIP:"#p1=10.10.7.24:sync:3260:1,10.10.6.24:heartbeat
:3260:1,172.31.10.24:heartbeat:3260:1" -IsAutoSynchEnabled:"1" -AuthChapLogin:"#p1=0b" -AuthChapPassword:"#p1=0b" -AuthMChapName:"#p1=0b" -AuthMChapSecret:"#p1=0b" -AuthCh
apType:"#p1=none" -Offset:"0" -CacheMode:"wb" -CacheSizeMB:"128" -serial:"EB83C6D4B55B3271" -eui64:"EB83C6D4B55B3271" -revision:"0001" -product:"STARWIND" -vendor:"STARWIN
D" -Replicator:"#p0=0" -WitnessType:"0" -AluaAccessState:"#p0=0;#p1=0"
-
200 Failed: invalid partner info..
Code: Select all
VSAN01 Targets:
Name : iqn.2008-08.com.starwindsoftware:starwind1.int.postresromar.com-storage1
Id : 0x0000000000ECA340
Alias : Storage1
IsClustered : True
Devices : System.__ComObject
Permissions : System.__ComObject
type :
VSAN01 Devices:
Name : HAImage1
DeviceType : HA Image
DeviceId : 0x0000000000EB1180
File : VSA Storage\mnt\DISK01\Storage1\Storage1_HA.swdsk
TargetName : iqn.2008-08.com.starwindsoftware:starwind1.int.postresromar.com-storage1
TargetId : 0x0000000000ECA340
Size : 2147483648000
CacheMode : none
CacheSize : 0
CacheBlockExpiryPeriod : 0
Exists : True
DeviceLUN : 0
IsSnapshotsSupported : False
Snapshots :
SectorSize : 512
State : 0
Parent :
Partners : System.__ComObject
SynchronizationChannels :
HeartbeatChannels :
SyncStatus : 1
SyncPercent : 0
IsWaitingAutosync : False
SyncTrafficShare : 50
NodeType : 1
FailoverStrategy : 0
MaintenanceMode : 0
Name : imagefile2
DeviceType : Image file
DeviceId : 0x0000000056DAAE40
File : VSA Storage\mnt\DISK01\disk01image.img
TargetName : empty
TargetId : empty
Size : 5242880000
CacheMode : wb
CacheSize : 128
CacheBlockExpiryPeriod : 5000
Exists : True
DeviceLUN :
IsSnapshotsSupported : False
Snapshots :
SectorSize : 512
State : 0
Parent :
Name : imagefile1
DeviceType : Image file
DeviceId : 0x0000000000EAD100
File : VSA Storage\mnt\DISK01\Storage1\Storage1.img
TargetName : empty
TargetId : empty
Size : 2147483648000
CacheMode : none
CacheSize : empty
CacheBlockExpiryPeriod : empty
Exists : True
DeviceLUN :
IsSnapshotsSupported : False
Snapshots :
SectorSize : 512
State : 0
Parent : HAImage1
VSAN02 Targets:
Name : iqn.2008-08.com.starwindsoftware:172.31.10.24-storage1
Id : 0x0000000000F7B040
Alias : Storage1
IsClustered : True
Devices : System.__ComObject
Permissions : System.__ComObject
type :
VSAN02 Devices:
Name : HAImage1
DeviceType : HA Image
DeviceId : 0x0000000000EB10C0
File : VSA Storage\mnt\DISK01\Storage1\Storage1_HA.swdsk
TargetName : iqn.2008-08.com.starwindsoftware:172.31.10.24-storage1
TargetId : 0x0000000000F7B040
Size : 2147483648000
CacheMode : none
CacheSize : 0
CacheBlockExpiryPeriod : 0
Exists : True
DeviceLUN : 0
IsSnapshotsSupported : False
Snapshots :
SectorSize : 512
State : 0
Parent :
Partners : System.__ComObject
SynchronizationChannels :
HeartbeatChannels :
SyncStatus : 3
SyncPercent : 0
IsWaitingAutosync : False
SyncTrafficShare : 50
NodeType : 1
FailoverStrategy : 0
MaintenanceMode : 0
Name : imagefile1
DeviceType : Image file
DeviceId : 0x0000000000EB0B00
File : VSA Storage\mnt\DISK01\Storage1\Storage1.img
TargetName : empty
TargetId : empty
Size : 2147483648000
CacheMode : none
CacheSize : empty
CacheBlockExpiryPeriod : empty
Exists : True
DeviceLUN :
IsSnapshotsSupported : False
Snapshots :
SectorSize : 512
State : 0
Parent : HAImage1
Code: Select all
-rw-r--r-- 1 root root 5242880000 Apr 25 12:55 disk01image.img
-rw-r--r-- 1 root root 4096 Apr 25 12:55 disk01image.swdsk