StarWind iSCSI SAN
StarWind Native SAN for Hyper-V
 

Can't create HA device with Powershell

Pure software-based VM-centric and flash-friendly VM storage (iSCSI, SMB3, NFS, iSER and NVMe over Fabrics) including free version. Same software embedded on StarWind ready nodes.

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

Can't create HA device with Powershell

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

Re: Can't create HA device with Powershell

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

Re: Can't create HA device with Powershell

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

Re: Can't create HA device with Powershell

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

Re: Can't create HA device with Powershell

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

Re: Can't create HA device with Powershell

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

Re: Can't create HA device with Powershell

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

Re: Can't create HA device with Powershell

Postby Serhi » Thu Mar 28, 2019 10:16 am

Hi,
and how it will help us?

BR, Serhi
Serhi
 
Posts: 20
Joined: Mon Mar 25, 2019 4:01 pm

Re: Can't create HA device with Powershell

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

Re: Can't create HA device with Powershell

Postby Serhi » Thu Mar 28, 2019 12:04 pm

Sajmon wrote:Thank you for suggestions !

You're welcome ;)

BR, Serhi
Serhi
 
Posts: 20
Joined: Mon Mar 25, 2019 4:01 pm

Re: Can't create HA device with Powershell

Postby Oleg(staff) » Thu Mar 28, 2019 12:27 pm

Sajmon, Serhi,
Thank you for this conversation :)
Oleg(staff)
Staff
 
Posts: 567
Joined: Fri Nov 24, 2017 7:52 am


Return to StarWind Virtual SAN / StarWind Virtual SAN Free / StarWind HyperConverged Appliance / StarWind Storage Appliance

Who is online

Users browsing this forum: No registered users and 4 guests