Page 1 of 1

Issues Setting up vSAN Free with HyperV

Posted: Sat Sep 02, 2023 5:32 pm
by StarWindN00b
Hello all,

I will preface this by saying I am totally new to this software. I am using the Free version as this will be a homelab deployment to see how this software works.

Setup:

2 Optiplex desktops with Server 2022 installed. Hyper-v in installed and setup.

Both are on the same domain.
Both are in the same subnet and can communicate.

I edit the CreateHA2.ps1 and run it. I have gotten to the point where I get to this error:
Request to LAB-HYPER1.DOMAIN.LOCAL ( 192.168.1.24 ) : 3261
-
control HAImage -CreateHeader:"" -DeviceHeaderPath:"My computer\V\masterImg21_HA.swdsk" -Type:"ImageFile_HA" -file:"imagefile1" -size:"12" -Priority:"#p0=0;#p1=1" -nodeType:"#p0=1;#p
1=1" -PartnerTargetName:"#p1=iqn.2008-08.com.starwindsoftware:192.168.1.25-partnerha22" -PartnerIP:"#p1=192.168.1.25:sync:3260:1" -IsAutoSynchEnabled:"1" -AuthChapLogin:"#p1=0b" -Aut
hChapPassword:"#p1=0b" -AuthMChapName:"#p1=0b" -AuthMChapSecret:"#p1=0b" -AuthChapType:"#p1=none" -Offset:"0" -CacheMode:"wb" -CacheSizeMB:"128" -serial:"E6D20ED65518C396" -eui64:"E6
D20ED65518C396" -revision:"0001" -product:"STARWIND" -vendor:"STARWIND" -Replicator:"#p0=0" -WitnessType:"0" -AluaAccessState:"#p0=0;#p1=0"
-
200 Failed: invalid partner info..

My question is, how do I decode this error message. What am I looking for here to decode what is going on?

If you need more information, let me know. I am not sure what other info you may need.

Thanks in advance!

Re: Issues Setting up vSAN Free with HyperV

Posted: Sat Sep 02, 2023 5:57 pm
by yaroslav (staff)
Hi,

Welcome to StarWind forum. Can I see the script you use?

Re: Issues Setting up vSAN Free with HyperV

Posted: Sat Sep 02, 2023 10:06 pm
by StarWindN00b
Duh. My bad. here you are. Thanks for the fast reply!

Code: Select all

param
(
$addr="192.168.1.24", $port=3261, $user="root", $password="starwind",
$addr2="192.168.1.25", $port2=$port, $user2=$user, $password2=$password,

#common
	$initMethod="Clear",
	$size=12,
	$sectorSize=512,
	$failover=0,
#primary node
	$imagePath="My computer\V",
	$imageName="masterImg21",
	$createImage=$true,
	$storageName="",
	$targetAlias="LAB-Hyper1",
	$autoSynch=$true,
	$poolName="pool1",
	$syncSessionCount=1,
	$aluaOptimized=$true,
	$cacheMode="wb",
	$cacheSize=128,
	$syncInterface="#p2=192.168.1.25:3260" -f $addr2,
	$hbInterface="",
	$createTarget=$true,
#secondary node
	$imagePath2="My computer\V",
	$imageName2="partnerImg22",
	$createImage2=$true,
	$storageName2="",
	$targetAlias2="partnerha22",
	$autoSynch2=$true,
	$poolName2="pool1",
	$syncSessionCount2=1,
	$aluaOptimized2=$true,
	$cacheMode2=$cacheMode,
	$cacheSize2=$cacheSize,
	$syncInterface2="#p1=192.168.1.24:3260" -f $addr,
	$hbInterface2="",
	$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
    
	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: Issues Setting up vSAN Free with HyperV

Posted: Sat Sep 02, 2023 11:05 pm
by yaroslav (staff)
Greetings,

I can see that your script misses the heartbeat.
1. comment out everything saying btmpstrategy or set one of the values.
2. try syncfromfirst instead of clear value for initmethod
3. See host syntaxes https://forums.starwindsoftware.com/vie ... p+3#p31505
See more on bitmap https://knowledgebase.starwindsoftware. ... a-devices/ see more on values you can use https://www.starwindsoftware.com/resour ... chine-cvm/ under the area where the script is discussed.

Please make sure the system satisfies network redundancy requirements https://www.starwindsoftware.com/system-requirements

Re: Issues Setting up vSAN Free with HyperV

Posted: Sun Sep 03, 2023 1:09 am
by StarWindN00b
Maybe I am missing what is required. I think that one link you sent shows that. How many network links does this require to work. For this proof of concept, I only have 1 nic on each machine. When I move to actually use this, what is the ideal situation for this software?

I'm sorry if these are basic questions, I am new to how this works and am more familiar with other vSAN solutions.

Thank you for bearing with me.

I will look at these other suggestions as well and implement them.

Re: Issues Setting up vSAN Free with HyperV

Posted: Sun Sep 03, 2023 3:10 am
by StarWindN00b
Alright, I have an update that is different now.

I now have 2 Nics per Optiplex. Here is my new script, and then my new error.

Code: Select all

param
(
$addr="192.168.1.24", $port=3261, $user="root", $password="starwind",
$addr2="192.168.1.25", $port2=$port, $user2=$user, $password2=$password,

#common
	$initMethod="SyncFromFirst",
	$size=12,
	$sectorSize=512,
	$failover=0,
#primary node
	$imagePath="My computer\V",
	$imageName="masterImg21",
	$createImage=$true,
	$storageName="",
	$targetAlias="LAB-Hyper1",
	$autoSynch=$true,
	$poolName="pool1",
	$syncSessionCount=1,
	$aluaOptimized=$true,
	$cacheMode="wb",
	$cacheSize=128,
	$syncInterface="#p2=10.10.10.2:3260" -f $addr2,
	$hbInterface="#p2=192.168.1.25:3260" -f $addr2,
	$createTarget=$true,
#secondary node
	$imagePath2="My computer\V",
	$imageName2="partnerImg22",
	$createImage2=$true,
	$storageName2="",
	$targetAlias2="partnerha22",
	$autoSynch2=$true,
	$poolName2="pool1",
	$syncSessionCount2=1,
	$aluaOptimized2=$true,
	$cacheMode2=$cacheMode,
	$cacheSize2=$cacheSize,
	$syncInterface2="#p1=10.10.10.1:3260" -f $addr,
	$hbInterface2="#P1=192.168.1.24: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
    
	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()
}
New Error:
Invalid channel format [2]

Re: Issues Setting up vSAN Free with HyperV

Posted: Sun Sep 03, 2023 10:19 pm
by yaroslav (staff)
It is strongly recommended to use 2 physical NICs to avoid split brain (https://www.starwindsoftware.com/blog/w ... o-avoid-it). See more in the link I shared above and best practices (https://www.starwindsoftware.com/best-p ... practices/).
Please also remove write-back caching (more about caching https://knowledgebase.starwindsoftware. ... rinciples/).
Try also p (lower case) instead of upper case.

Re: Issues Setting up vSAN Free with HyperV

Posted: Mon Sep 04, 2023 3:22 am
by StarWindN00b
OK, I'd say the P was the issue there. I made the other changes and no change from before. Followed some of the other documentation you sent and I am really having a hard time finding the issue. I'm sorry to be such a pain.

Code: Select all

param
(
$addr="192.168.1.24", $port=3261, $user="root", $password="starwind",
$addr2="192.168.1.25", $port2=$port, $user2=$user, $password2=$password,

#common
	$initMethod="SyncFromFirst",
	$size=12,
	$sectorSize=512,
	$failover=0,
#primary node
	$imagePath="My computer\V",
	$imageName="masterImg21",
	$createImage=$true,
	$storageName="",
	$targetAlias="LAB-Hyper1",
	$autoSynch=$true,
	$poolName="pool1",
	$syncSessionCount=1,
	$aluaOptimized=$true,
	$cacheMode="none",
	$cacheSize=128,
    $syncInterface="#p2={0}:3261" -f "10.10.10.2",
	$hbInterface="#p2=192.168.1.25:3261",
	#$syncInterface="#p2=10.10.10.2:3260" -f $addr2,
	#$hbInterface="#p2=192.168.1.25:3260" -f $addr2,
	$createTarget=$true,
#secondary node
	$imagePath2="My computer\V",
	$imageName2="partnerImg22",
	$createImage2=$true,
	$storageName2="",
	$targetAlias2="partnerha22",
	$autoSynch2=$true,
	$poolName2="pool1",
	$syncSessionCount2=1,
	$aluaOptimized2=$true,
	$cacheMode2=$cacheMode,
	$cacheSize2=$cacheSize,
    $syncInterface2="#p2={0}:3261" -f "10.10.10.1",
	$hbInterface2="#p2=192.168.1.24:3261",
	#$syncInterface2="#p1=10.10.10.1:3260" -f $addr,
	#$hbInterface2="#p1=192.168.1.24: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
    
	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()
}
Error:
Request to LAB-HYPER1.DOMAIN.LOCAL ( 192.168.1.24 ) : 3261
-
control HAImage -CreateHeader:"" -DeviceHeaderPath:"My computer\V\masterImg21_HA.swdsk" -Type:"ImageFile_HA" -file:"imagefile10" -size:"12" -Priority:"#p0=0;#p1=1" -nodeType:"#p0=1;#
p1=1" -PartnerTargetName:"#p1=iqn.2008-08.com.starwindsoftware:192.168.1.25-partnerha22" -PartnerIP:"#p1=10.10.10.2:sync:3261:1,192.168.1.25:heartbeat:3261:1" -IsAutoSynchEnabled:"1"
-AuthChapLogin:"#p1=0b" -AuthChapPassword:"#p1=0b" -AuthMChapName:"#p1=0b" -AuthMChapSecret:"#p1=0b" -AuthChapType:"#p1=none" -Offset:"0" -CacheMode:"none" -CacheSizeMB:"128" -seria
l:"D73CB84A4D8FB71F" -eui64:"D73CB84A4D8FB71F" -revision:"0001" -product:"STARWIND" -vendor:"STARWIND" -Replicator:"#p0=0" -WitnessType:"0" -AluaAccessState:"#p0=0;#p1=0"
-
200 Failed: invalid partner info..

Re: Issues Setting up vSAN Free with HyperV

Posted: Mon Sep 04, 2023 3:41 am
by yaroslav (staff)
Hi,

Please see this script once again https://forums.starwindsoftware.com/vie ... p+3#p31505
The script you sent again contains unnecessary lines. Remove these lines from your script

Code: Select all

$syncInterface="#p2={0}:3261" -f "10.10.10.2",
   $hbInterface="#p2=192.168.1.25:3261",
and

Code: Select all

    $syncInterface2="#p2={0}:3261" -f "10.10.10.1",
   $hbInterface2="#p2=192.168.1.24:3261",

Re: Issues Setting up vSAN Free with HyperV

Posted: Mon Sep 04, 2023 5:30 pm
by StarWindN00b
Not sure I understand what you mean? I built those lines based on the script you sent and commented out the older lines. If it is supposed to look like his script, then I should leave the lines in that you stated and removed the commented line for cleanliness. Are you saying I no longer need to tell the script which interfaces I am supposed to use for HB and Sync? Which of the below is correct?


Removed the lines and uncommented the original.

Code: Select all

param
(
$addr="192.168.1.24", $port=3261, $user="root", $password="starwind",
$addr2="192.168.1.25", $port2=$port, $user2=$user, $password2=$password,

#common
	$initMethod="SyncFromFirst",
	$size=12,
	$sectorSize=512,
	$failover=0,
#primary node
	$imagePath="My computer\V",
	$imageName="masterImg21",
	$createImage=$true,
	$storageName="",
	$targetAlias="LAB-Hyper1",
	$autoSynch=$true,
	$poolName="pool1",
	$syncSessionCount=1,
	$aluaOptimized=$true,
	$cacheMode="none",
	$cacheSize=128,
	$syncInterface="#p2=10.10.10.2:3260" -f $addr2,
	$hbInterface="#p2=192.168.1.25:3260" -f $addr2,
	$createTarget=$true,
#secondary node
	$imagePath2="My computer\V",
	$imageName2="partnerImg22",
	$createImage2=$true,
	$storageName2="",
	$targetAlias2="partnerha22",
	$autoSynch2=$true,
	$poolName2="pool1",
	$syncSessionCount2=1,
	$aluaOptimized2=$true,
	$cacheMode2=$cacheMode,
	$cacheSize2=$cacheSize,
	$syncInterface2="#p1=10.10.10.1:3260" -f $addr,
	$hbInterface2="#p1=192.168.1.24: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
    
	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()
}

Deleted the commented out lines.

Code: Select all

param
(
$addr="192.168.1.24", $port=3261, $user="root", $password="starwind",
$addr2="192.168.1.25", $port2=$port, $user2=$user, $password2=$password,

#common
	$initMethod="SyncFromFirst",
	$size=12,
	$sectorSize=512,
	$failover=0,
#primary node
	$imagePath="My computer\V",
	$imageName="masterImg21",
	$createImage=$true,
	$storageName="",
	$targetAlias="LAB-Hyper1",
	$autoSynch=$true,
	$poolName="pool1",
	$syncSessionCount=1,
	$aluaOptimized=$true,
	$cacheMode="none",
	$cacheSize=128,
    $syncInterface="#p2={0}:3261" -f "10.10.10.2",
	$hbInterface="#p2=192.168.1.25:3261",
	$createTarget=$true,
#secondary node
	$imagePath2="My computer\V",
	$imageName2="partnerImg22",
	$createImage2=$true,
	$storageName2="",
	$targetAlias2="partnerha22",
	$autoSynch2=$true,
	$poolName2="pool1",
	$syncSessionCount2=1,
	$aluaOptimized2=$true,
	$cacheMode2=$cacheMode,
	$cacheSize2=$cacheSize,
    $syncInterface2="#p2={0}:3261" -f "10.10.10.1",
	$hbInterface2="#p2=192.168.1.24:3261",
	$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
    
	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()
}

Deleted all hb and Sync interface variables.

Code: Select all

param
(
$addr="192.168.1.24", $port=3261, $user="root", $password="starwind",
$addr2="192.168.1.25", $port2=$port, $user2=$user, $password2=$password,

#common
	$initMethod="SyncFromFirst",
	$size=12,
	$sectorSize=512,
	$failover=0,
#primary node
	$imagePath="My computer\V",
	$imageName="masterImg21",
	$createImage=$true,
	$storageName="",
	$targetAlias="LAB-Hyper1",
	$autoSynch=$true,
	$poolName="pool1",
	$syncSessionCount=1,
	$aluaOptimized=$true,
	$cacheMode="none",
	$cacheSize=128,
	$createTarget=$true,
#secondary node
	$imagePath2="My computer\V",
	$imageName2="partnerImg22",
	$createImage2=$true,
	$storageName2="",
	$targetAlias2="partnerha22",
	$autoSynch2=$true,
	$poolName2="pool1",
	$syncSessionCount2=1,
	$aluaOptimized2=$true,
	$cacheMode2=$cacheMode,
	$cacheSize2=$cacheSize,
	$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
    
	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: Issues Setting up vSAN Free with HyperV

Posted: Mon Sep 04, 2023 6:39 pm
by yaroslav (staff)
Greetings,

The script heartbeat and sync in the first script

Code: Select all

$syncInterface="#p2=10.10.10.2:3260" -f $addr2,
$hbInterface="#p2=192.168.1.25:3260" -f $addr2,
and the second

Code: Select all

$syncInterface="#p2={0}:3261" -f "10.10.10.2",
$hbInterface="#p2=192.168.1.25:3261",
it had #p2={0}:3261" added.

As a reference, you can use https://forums.starwindsoftware.com/vie ... p+3#p31505.