Hi,
I'm a beginner with power shell and I need some help.
I'm trying to write script which will setup "Fixed" path policy with preferred path. But the catch is that I need to setup specific path which is being delivered by VSA which runs as a vm on top of host.
So path needs to point to locally running VSA appliance so IOs are processed internally within ESXi and they do not travel over physical network.
For example I'm running iscsi appliance A on ESXi host A and i need setup iSCSI software adapter to use preferred path pointing to specific IP of appliance A.
Bit which I'm missing is how to figure it pout which path leads to local IP of vm running on host which iSCSi software adaptor I'm configuring.
Please excuse my language . English is not my native language.
With kind regards
Greg U.
If I understand it correctly, you need to know the IP address of the iSCSI appliance, so you can configure the correct iSCSI target.
Or am I interpreting your question incorrectly ?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hi LucD,
Sorry I was not precise.
I know all IPs. I know configuration of all environment.
What I don't know is method which I can use to determine which iSCSI path is pointing to network interface of iSCSI appliance with particular IP address.
In my situation I'm running VM with three network interfaces . One for management and two for delivering block device over iSCSI protocol. Requirement is to setup Fixed path policy for each block device with preferred path pointing to particular network interface of storage appliance.
For example storage appliance is setup like this:
NIC1: (management): 192.168.1.1/24
NIC2: (iSCSI1): 172.16.1.1/16
NIC2: (iSCSI2): 172.16.2.2/16
I need to tell ESXI that for each target which will have over MPIO two paths to the same block device to use only path pointing to iSCSI1 (172.16.1.1/16). So my question is what command can I use to setup this? How can I figure it out which path leads to NIC2 using powerCLI?
Kind regards
Greg U.
Do you know the name of the vNIC and the portgroup ?
What does this return ? And can you select from these which is the one you need ?
$vm = Get-VM -Name <ApplianceVMName>
$vm.Guest.Nics | Select @{N="VM";E={$vm.Name}},
@{N="IP";E={[String]::Join(',',$_.IPAddress)}},NetworkName,MacAddress
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
LucD,
First of all thank you for your support. I really appreciate.
Command which you send returns VM name ,Ip address , NetworName and MacAddress.
VM IP NetworkName MacAddress
-- -- ----------- ----------
VSAchallenger 192.168.1.1 VM Network 00:50:56:b3:4e:fc
VSAchallenger 172.16.1.1 iSCSInet1 00:50:56:b3:16:9e
VSAChallenger 172.16.2.2 iSCSInet2
One of Ip addresses is IP which is assigned to nic which I want to point to.
I don't know vNIC or portgroup.
Kind regards
Greg U.
The portgroupname is in the NetworkName column.
My question was to know if you can make a selection of the correct connection based on the info you have in that table (IP address + portgroupname)
I guess that Network adapter 2 in the appliance VM is connected to portgroup iSCSInet1.
So it would be IP 172.16.1.1 you would need to use.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
LucD,
Yes, I believe I can as this config will be exactly the same on all environments.
Kind regards
Greg U.
LucD,
Determine which IP to use was not an issue if they always the same.
How can I check if this path iqn.1998-01.com.vmware:challenger-046c44cf-00023d000003,iqn.2006-06.com.stormagic:4639bd0200000009.test1,t,2-eui.0003394639bd0001 lead to this IP 172.16.1.1 so I can mark it as preferred.
Kind regards
Greg U.
Isn't Get-IScsiHbaTarget providing that information ?
Try a
Get-IScsiHbaTarget | Select *
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
LucD,
I believe Get-IScsiHbaTarget | Select * gives me IP and IQN but not path and difference between path and IQN is that with MPIO IQN will be the same for all paths leading to the same block device regardless IP address. Paths will differentiate between IPs.
If you are aware on any way how to connect this, please save me from my torment
Kind regards
Greg U.
LucD,
I've attempted to run this sequence and it failed (if it helps):
$path_path = Get-IscsiHBATarget -Type Static -IPEndPoint 172.16.1.1
This return one value:
PowerCLI C:\> echo $path_path | select *
IScsiName : iqn.2006-06.com.stormagic:4639bd0200000009.test1
Address : 172.16.1.1
Port : 3260
IScsiHbaKey : key-vim.host.InternetScsiHba-vmhba33
AuthenticationProperties : Chap:Prohibited
Type : Static
Uid : /VIServer=administrator@vsphere.local@gregvc:443/VMH
ost=HostSystem-host-343/Hba=key-vim.host.InternetScs
iHba-vmhba33/IScsiHbaTarget=172.16.1.1:3260:Static/
Name : 172.16.1.1:3260
IScsiHbaName : iqn.1998-01.com.vmware:challenger-046c44cf
ExtensionData : VMware.Vim.HostInternetScsiHbaStaticTarget
VmHostId : HostSystem-host-343
HostStorageSystemId : HostStorageSystem-storageSystem-343
Client : VMware.VimAutomation.ViCore.Impl.V1.VimClient
Next step was:
$LUNs = get-vmhost challenger.exsequi.com | Get-ScsiLun -CanonicalName "eui*"
Result:
PowerCLI C:\> echo $LUNs
CanonicalN ConsoleDeviceName LunType CapacityGB MultipathP
ame olicy
---------- ----------------- ------- ---------- ----------
eui.000... /vmfs/devices/disks/eui.000... disk 10.000 Fixed
Then last set:
PowerCLI C:\> $LUNs | Set-ScsiLun -MultipathPolicy "Fixed" -Preferredpath $path_
path
Resulted with this:
Set-ScsiLun : Cannot bind parameter 'PreferredPath'. Cannot convert the
"Static-192.168.1.5:3260" value of type
"VMware.VimAutomation.ViCore.Impl.V1.Host.Storage.IScsiHbaStaticTargetImpl" to
type "VMware.VimAutomation.ViCore.Types.V1.Host.Storage.Scsi.ScsiLunPath".
At line:1 char:61
+ $LUNs | Set-ScsiLun -MultipathPolicy "Fixed" -Preferredpath $path_path
+ ~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Set-ScsiLun], ParameterBin
dingException
+ FullyQualifiedErrorId : CannotConvertArgumentNoMessage,VMware.VimAutomat
ion.ViCore.Cmdlets.Commands.Host.SetScsiLun
Kind regards
Greg U.