Page 1 of 1

Can't create HA device with Powershell

Posted: Fri Mar 22, 2019 3:53 pm
by Sajmon
Hello folks,
I know it has been discussed many times already, but I can't seem to create a HA device with the powershell module. I have looked at the script handful of times and I am pretty sure I am missing some detail. Maybe a fresh pair of eyes can see what I'm overlooking. One thing I noticed, the image gets created on the second node, but not the first one. All the attempts end up with error "200 Failed: operation cannot be completed." . And yes, Syncinterface and HBinterface are IP's for the partner nodes.

Import-Module StarWindX
try
{
Enable-SWXLog
$server = New-SWServer -host 127.0.0.1 -port 3261 -user root -password starwind
$server.Connect()
$firstNode = new-Object Node
$firstNode.HostName = "172.23.99.10"
$firstNode.ImagePath = "My computer\D\Cluster"
$firstNode.ImageName = "Wittness"
$firstNode.Size = 1024
$firstNode.CreateImage = $true
$firstNode.TargetAlias = "Wittness"
$firstNode.AutoSynch = $true
$firstNode.SyncInterface = "#p2=10.10.12.13:3260,10.10.12.14:3260"
$firstNode.HBInterface = "#p2=10.10.11.11:3260,10.10.13.11:3260,172.23.99.11:3260"
$firstNode.PoolName = "pool1"
$firstNode.SyncSessionCount = 1
$firstNode.ALUAOptimized = $true

#
# device sector size. Possible values: 512 or 4096(May be incompatible with some clients!) bytes.
#
$firstNode.SectorSize = 4096
$secondNode = new-Object Node
$secondNode.HostName = "172.23.99.11"
$secondNode.HostPort = "3261"
$secondNode.Login = "root"
$secondNode.Password = "starwind"
$secondNode.ImagePath = "My computer\D\Cluster"
$secondNode.ImageName = "Wittness"
$secondNode.Size = 1024
$secondNode.CreateImage = $true
$secondNode.TargetAlias = "Wittness"
$secondNode.AutoSynch = $true
$secondNode.SyncInterface = "#p1=p2=10.10.12.10:3260,10.10.12.11:3260"
$secondNode.HBInterface = "#p1=10.10.11.10:3260,10.10.13.10:3260,172.23.99.10:3260"
$secondNode.SyncSessionCount = 1
$secondNode.ALUAOptimized = $true

$device = Add-HADevice -server $server -firstNode $firstNode -secondNode $secondNode -initMethod "Clear"
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()
}

Re: Can't create HA device with Powershell

Posted: Mon Mar 25, 2019 4:20 pm
by Serhi
Hello Sajmon

I checked this script in my StarWind, it's working

Image

Please, look at the sample (C:\Program Files\StarWind Software\StarWind\StarWindX\Samples\powershell\CreateHA(two nodes).ps1)
I'll guess that error is due to the same target alias names.

Re: Can't create HA device with Powershell

Posted: Tue Mar 26, 2019 4:12 pm
by Sajmon
Hello Serhi,
thanks for suggestion. Changed the target names as you suggested and it works. Another problem was that I totally forgot to change executionpolicy to unrestricted. Now I have to figure out how to specify SSD cache for the volume.

Re: Can't create HA device with Powershell

Posted: Tue Mar 26, 2019 5:06 pm
by Serhi
Sajmon wrote: Now I have to figure out how to specify SSD cache for the volume.
Hello Sajmon

I'm very glad that my advice helped. What do you mean about SSD cache for the volume? For Windows volume, or you mean StarWind HA?

BR, Serhi

Re: Can't create HA device with Powershell

Posted: Wed Mar 27, 2019 7:59 am
by Sajmon
Basically I have 2 SSD drives per server and I want to use them as a chache. I guess it's L2 cache in Starwind terminology. Wittness disk doesn't have to have a cache, but CSV's might need some, so everything runs smooth. Unfortunately example scripts have no mention of the cache configuration whatsoever.

Re: Can't create HA device with Powershell

Posted: Wed Mar 27, 2019 8:52 am
by Serhi
Sajmon wrote: Unfortunately example scripts have no mention of the cache configuration whatsoever.
Hello Sajmon!

I guess this option isn't available in StarWindX powershell.

BR, Serhi

Re: Can't create HA device with Powershell

Posted: Thu Mar 28, 2019 10:06 am
by Sajmon
Hi,
I found out that I have to edit headers for this. However L1 can be setup with powershell.

Re: Can't create HA device with Powershell

Posted: Thu Mar 28, 2019 10:16 am
by Serhi
Hi,
and how it will help us?

BR, Serhi

Re: Can't create HA device with Powershell

Posted: Thu Mar 28, 2019 11:36 am
by Sajmon
Not sure how it helps you, but I was able to configure Ha device with L1 and L2 cache, and that's basically all I wanted to do :-) So i guess this thread can be closed as solved. Thank you for suggestions !

Re: Can't create HA device with Powershell

Posted: Thu Mar 28, 2019 12:04 pm
by Serhi
Sajmon wrote:Thank you for suggestions !
You're welcome ;)

BR, Serhi

Re: Can't create HA device with Powershell

Posted: Thu Mar 28, 2019 12:27 pm
by Oleg(staff)
Sajmon, Serhi,
Thank you for this conversation :)