Page 1 of 1

Server 2022 Hyper-V- Free vSAN Setup Error

Posted: Tue Nov 21, 2023 1:27 pm
by rfarhank
Hi,

I am looking for support, I have been trying to setup 2 node Starwind vSan using the Free license via Powershell but seems to be running into multiple errors. I have tried to follow the guide provided but seems to be getting multiple errors. i.e.
Target name and Alias are empty
Error 200 Invalid Partner node info

I would really appreciate if anyone can help me with this. I have provided my amended script below:-


param($addr="192.168.80.55", $port=3261, $user="root", $password="starwind",
$addr2="192.168.80.56", $port2=$port, $user2=$user, $password2=$password,
#common
$initMethod="Clear",
$size=1200,
$sectorSize=512,
$failover=0,
$bmpType=1,
$bmpStrategy=0,
#primary node
$imagePath="My computer\D\starwind",
$imageName="masterImg21",
$createImage=$true,
$storageName="",
$targetAlias="targetha21",
$autoSynch=$true,
$poolName="pool1",
$syncSessionCount=1,
$aluaOptimized=$true,
$cacheMode="wb",
$cacheSize=128,
$syncInterface="#p2=172.16.10.20:3260" -f $addr2,
$hbInterface="#p2=172.16.20.20,192.168.80.56:3260" -f $addr2,
$createTarget=$true,
$bmpFolderPath="",
#secondary node
$imagePath2="My computer\D\starwind",
$imageName2="partnerImg22",
$createImage2= $true,
$storageName2="",
$targetAlias2="partnerha22",
$autoSynch2=$true,
$poolName2="pool1",
$syncSessionCount2=1,
$aluaOptimized2=$true,
$cacheMode2=$cacheMode,
$cacheSize2=$cacheSize,
$syncInterface2="#p1=172.16.10.10:3260" -f $addr,
$hbInterface2="#p1=172.16.20.10:3260,192.168.80.55:3260" -f $addr2,
$createTarget2=$true,
$bmpFolderPath2=""
)

Import-Module StarWindX

try
{
Enable-SWXLog -level SW_LOG_LEVEL_DEBUG

$server = New-SWServer -host 127.0.0.1 -port 3261 -user root -password starwind

$server.Connect()

$firstNode = new-Object Node

$firstNode.HostName = "localhost"
$firstNode.HostPort = "3261"
$firstNode.Login = "root"
$firstNode.Password = "starwind"
$firstNode.ImagePath = "My computer\D\starwind"
$firstNode.ImageName = "masterImg21"
$firstNode.Size = 2048
$firstNode.CreateImage = $true
$firstNode.StorageName = ""
$firstNode.TargetAlias = "targetha21"
$firstNode.AutoSynch = $true
$firstNode.SyncInterface = "#p1=172.16.10.10:3260" -f $addr
$firstNode.HBInterface = "#p2=172.16.20.20,192.168.80.56:3260" -f $addr2
$firstNode.PoolName = "pool1"
$firstNode.SyncSessionCount = 1
$firstNode.ALUAOptimized = $true
$firstNode.CacheMode = "wb"
$firstNode.CacheSize = "128"
$firstNode.FailoverStrategy = $failover
$firstNode.CreateTarget = $true
$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 = 4096

$secondNode = new-Object Node

$secondNode.HostName = "172.16.10.20"
$secondNode.HostPort = "3261"
$secondNode.Login = "root"
$secondNode.Password = "starwind"
$secondNode.ImagePath = "My computer\D\starwind"
$secondNode.ImageName = "partnerImg22"
$secondNode.CreateImage = "$true
$secondNode.StorageName = ""
$secondNode.TargetAlias = "Partnerha22"
$secondNode.AutoSynch = $true
$secondNode.SyncInterface = "#p1=172.16.10.10:3260",
$secondNode.HBInterface = "#p1=172.16.20.10:3260,192.168.80.55:3260" -f $addr2
$secondNode.SyncSessionCount = 1
$secondNode.ALUAOptimized = $true
$secondNode.CacheMode = "none"
$secondNode.CacheSize = ""
$secondNode.FailoverStrategy = $failover
$secondNode.CreateTarget = $true
$secondNode.BitmapFolderPath = $bmpFolderPath2

$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: Server 2022 Hyper-V- Free vSAN Setup Error

Posted: Tue Nov 21, 2023 1:59 pm
by yaroslav (staff)
Welcome to Starwind Forum and thanks for sharing your script. Use this script https://forums.starwindsoftware.com/vie ... p+3#p31505.
Alternatively, type a valid bitmap path or comment on all lines about bitmap.

Re: Server 2022 Hyper-V- Free vSAN Setup Error

Posted: Wed Nov 22, 2023 12:47 pm
by rfarhank
Thanks Yarosluv for your prompt response.

As suggested I have commented all bitmap line, however I am still getting the error "Invalid Partner Info ", (Please see image attached for full error)
Invalid Partner info.png
Invalid Partner info.png (141.92 KiB) Viewed 7269 times
However I have noticed in management console (monitoring only) that it has created an image file on Node 1 but not replicated on second node.
Starwind Managment console status.png
Starwind Managment console status.png (36.38 KiB) Viewed 7269 times
Please Advise, your help would be much appreciated.

See below my final script which I had used:-

Import-Module StarWindX

try
{
Enable-SWXLog -level SW_LOG_LEVEL_DEBUG

$server = New-SWServer -host 127.0.0.1 -port 3261 -user root -password starwind

$server.Connect()

$firstNode = new-Object Node

$firstNode.HostName = "localhost"
$firstNode.HostPort = "3261"
$firstNode.Login = "root"
$firstNode.Password = "starwind"
$firstNode.ImagePath = "My computer\D\starwind"
$firstNode.ImageName = "masterImg30"
$firstNode.Size = 1024
$firstNode.CreateImage = $true
$firstNode.StorageName = ""
$firstNode.TargetAlias = "targetha30"
$firstNode.AutoSynch = $true
$firstNode.SyncInterface = "#p2=172.16.10.20:3260"
$firstNode.HBInterface = "#p2=172.16.20.20,192.168.80.56:3260"
$firstNode.PoolName = "Pool1"
$firstNode.SyncSessionCount = 1
$firstNode.ALUAOptimized = $true
$firstNode.CacheMode = ""
$firstNode.CacheSize = ""
$firstNode.FailoverStrategy = $failover
$firstNode.CreateTarget = $true
$firstNode.BitmapStoreType = ""
$firstNode.BitmapStrategy = ""
$firstNode.BitmapFolderPath = ""

#
# device sector size. Possible values: 512 or 4096(May be incompatible with some clients!) bytes.
#
$firstNode.SectorSize = 4096

$secondNode = new-Object Node

$secondNode.HostName = "192.168.80.56"
$secondNode.HostPort = "3261"
$secondNode.Login = "root"
$secondNode.Password = "starwind"
$secondNode.ImagePath = "My computer\D\starwind"
$secondNode.ImageName = "partnerImg30"
$secondNode.CreateImage = "$true"
$secondNode.StorageName = ""
$secondNode.TargetAlias = "Partnerha30"
$secondNode.AutoSynch = $true
$secondNode.SyncInterface = "#p1=172.16.10.10:3260"
$secondNode.HBInterface = "#p1=172.16.20.10,192.168.80.55:3260"
$secondNode.SyncSessionCount = 1
$secondNode.ALUAOptimized = $true
$secondNode.CacheMode = ""
$secondNode.CacheSize = ""
$secondNode.FailoverStrategy = $failover
$secondNode.CreateTarget = $true
$secondNode.BitmapFolderPath = ""

$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: Server 2022 Hyper-V- Free vSAN Setup Error

Posted: Wed Nov 22, 2023 1:45 pm
by yaroslav (staff)
Hi,

Thanks for your update. Could you please let me know if you had a chance to take the script I shared above and fit it into your system?
Will be waiting for your reply.

Re: Server 2022 Hyper-V- Free vSAN Setup Error

Posted: Wed Nov 22, 2023 2:09 pm
by rfarhank
Hi
Yes, I also ran the script that was provided in the (viewtopic.php?f=5&t=5624&p=31505&hilit=tip+3#p31505) see below.

When I ran this script it didn't do anything - it didn't throw any error but also not processed anything - please see image below
Shared Script Update.png
Shared Script Update.png (177.26 KiB) Viewed 7263 times

Re: Server 2022 Hyper-V- Free vSAN Setup Error

Posted: Wed Nov 22, 2023 3:16 pm
by yaroslav (staff)
Could you please clear out old entries from StarWind.cfg.
1. stop the service.
2. go to StarWind.cfg
3. locate <targets/> folder.
4. locate imagefiles.
5. remove the entries.
6. clear out the files from the underlying storage.
7. repeat for another server.
8. start StarWindService.

Also, try $initMethod="syncfromfirst" as described here https://forums.starwindsoftware.com/vie ... rst#p35005.