How to specify iSCSI target interface

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

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

Post Reply
seanpdiaz
Posts: 9
Joined: Tue Aug 06, 2024 8:47 am

Thu Sep 26, 2024 6:08 am

Hi there I am wondering how do I specify the correct interface and IP address to be used for the iSCSI targets when setting up a HA LUN using the PowerShell script "CreateHA_2". I have no problem getting the script to create the HA LUN however when it does it is using the "management" interface as opposed to the correct "data" interface as seen in the below photos.
Screenshot 2024-09-25 at 10.45.53 PM.png
Screenshot 2024-09-25 at 10.45.53 PM.png (120.15 KiB) Viewed 2505 times
Screenshot 2024-09-25 at 10.45.43 PM.png
Screenshot 2024-09-25 at 10.45.43 PM.png (53.25 KiB) Viewed 2505 times

Below is the script configuration options I am using, if you could please help me out with this or point me in the direction of the correct documentation because I was unsuccessful trying to locate it. Appreciate any and all help and thanks for your help.

Code: Select all

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

#common
	$initMethod="Clear",
	$size=100000,
	$sectorSize=512,
	$failover=0,
	$bmpType=2,
	$bmpStrategy=1,
#primary node
	$imagePath="/mnt/sdb1/vol01",
	$imageName="testha02",
	$createImage=$true,
	$storageName="",
	$targetAlias="target02",
	$autoSynch=$true,
	$poolName="pool1",
	$syncSessionCount=1,
	$aluaOptimized=$true,
	$cacheMode="none",
	$cacheSize=0,
	$syncInterface="#p2={0}:3260" -f "10.4.35.2",
	$hbInterface="#p2={0}:3260" -f "10.4.32.11",
	$createTarget=$true,
	$bmpFolderPath="/mnt/md0/nvmevol01", 
#secondary node
	$imagePath2="/mnt/sdb1/vol02",
	$imageName2="testha02",
	$createImage2=$true,
	$storageName2="",
	$targetAlias2="target02",
	$autoSynch2=$true,
	$poolName2="pool1",
	$syncSessionCount2=1,
	$aluaOptimized2=$false,
	$cacheMode2=$cacheMode,
	$cacheSize2=$cacheSize,
	$syncInterface2="#p1={0}:3260" -f "10.4.35.1",
	$hbInterface2="#p1={0}:3260" -f "10.4.32.10",
	$createTarget2=$true,
	$bmpFolderPath2="/mnt/md0/nvmevol02"
	)
	
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()
}
yaroslav (staff)
Staff
Posts: 2904
Joined: Mon Nov 18, 2019 11:11 am

Thu Sep 26, 2024 8:00 am

Welcome to StarWind Forum. The IP assignment in UI makes sense only if you create an HA device through WEB UI. While creating with PowerShell, the script will assign the IPs you supply.

P.s See one of the script samples on this forum here viewtopic.php?f=5&t=6852&p=37208&hilit=HINT8#p37208
Make sure you have redundant networks and the setup meets the best practices (https://www.starwindsoftware.com/best-p ... practices/) and system requirements (https://www.starwindsoftware.com/system-requirements).
seanpdiaz
Posts: 9
Joined: Tue Aug 06, 2024 8:47 am

Sat Sep 28, 2024 7:16 pm

Hi there I guess I am still a bit confused on this one as the PowerShell script only has 3 locations for an IP address to be entered for each node ( addr, syncInterface, hbInterface ). I do not see anything about where to specify which IP addresses the iSCSI target should be on.

Even after using the HA network config setup I still do not see how I would assign the iSCSI to a specific IP address related to an interface? Not quite sure what I am missing here and any guidance would be much appreciated as I looked through the documentation you sent in your last reply and again didn't see anything of relevance.
yaroslav (staff)
Staff
Posts: 2904
Joined: Mon Nov 18, 2019 11:11 am

Sun Sep 29, 2024 1:13 pm

I believe you are confusing StarWind VSAN and client storage connectivity layers.
StarWind VSAN has only two types of links when Heartbeat replication strategy is used: Synchronization and Heartbeat. Node Majority impies only use of synchronizatiin though. Synchronization is for data synchronization and ping. Heartbeat is only for ping. No iSCSI network here yet.
Data (i.e., iSCSI or NVME-OF) is for connecting storage to the client. In StarWind VSAN it can be used for heartbeat. It is initiator side where you discover storage over iSCSI, not in StarWind GUI.
IP assignment is done when setting up the VM. Please check https://www.starwindsoftware.com/resour ... al_papers/ for more info on VM configuration.
In other words, it is Initiator where you set up the network for iSCSI.
Post Reply