Can't create HA device with Powershell

Software-based VM-centric and flash-friendly VM storage + free version

Moderators: anton (staff), art (staff), Max (staff), Anatoly (staff)

Post Reply
Sajmon
Posts: 11
Joined: Fri Mar 22, 2019 3:39 pm

Fri Mar 22, 2019 3:53 pm

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()
}
Serhi
Posts: 21
Joined: Mon Mar 25, 2019 4:01 pm

Mon Mar 25, 2019 4:20 pm

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.
Sajmon
Posts: 11
Joined: Fri Mar 22, 2019 3:39 pm

Tue Mar 26, 2019 4:12 pm

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.
Serhi
Posts: 21
Joined: Mon Mar 25, 2019 4:01 pm

Tue Mar 26, 2019 5:06 pm

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
Sajmon
Posts: 11
Joined: Fri Mar 22, 2019 3:39 pm

Wed Mar 27, 2019 7:59 am

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.
Serhi
Posts: 21
Joined: Mon Mar 25, 2019 4:01 pm

Wed Mar 27, 2019 8:52 am

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
Sajmon
Posts: 11
Joined: Fri Mar 22, 2019 3:39 pm

Thu Mar 28, 2019 10:06 am

Hi,
I found out that I have to edit headers for this. However L1 can be setup with powershell.
Serhi
Posts: 21
Joined: Mon Mar 25, 2019 4:01 pm

Thu Mar 28, 2019 10:16 am

Hi,
and how it will help us?

BR, Serhi
Sajmon
Posts: 11
Joined: Fri Mar 22, 2019 3:39 pm

Thu Mar 28, 2019 11:36 am

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 !
Serhi
Posts: 21
Joined: Mon Mar 25, 2019 4:01 pm

Thu Mar 28, 2019 12:04 pm

Sajmon wrote:Thank you for suggestions !
You're welcome ;)

BR, Serhi
Oleg(staff)
Staff
Posts: 568
Joined: Fri Nov 24, 2017 7:52 am

Thu Mar 28, 2019 12:27 pm

Sajmon, Serhi,
Thank you for this conversation :)
Post Reply