Understand and apply LUN masking using PSA-related commands

ESXi Server comes with several native PSA (Pluggable Storage Architecture) to perform certain storage related tasks.

I will go though LUN Masking at ESXi server in this blog. Usually LUN Masking is configured at SAN device to hide LUNs from hosts (HBAs) but ESXi allows you to hide LUNs to be displayed although LUN(s) are not masked by SAN device.

In my lab environment, I have esxi-01 and iSCSI SAN. I will demonstrate how to hide LUN10 in this demonstration.

image

To add LUN_MASK at esxi server, you will need to access ESXi Shell environment to execute esxcli commands.

At first I need to find out Run Time Name and Device ID for the LUN I want to hide. In this demonstration I will be hiding LUN9 on iSCSI SAN.

Issue esxcli storage core path list command to find out Runtime Information for LUN. The output below shows only LUN that I am interested in.

~ # esxcli storage core path list

iqn.1998-01.com.vmware:localhost-63cfb246-00023d000001,iqn.2006-01.com.openfiler:tsn.1a129a7adeea,t,1-t10.F405E46494C454008786F657F634D2874415F6D275577674
UID: iqn.1998-01.com.vmware:localhost-63cfb246-00023d000001,iqn.2006-01.com.openfiler:tsn.1a129a7adeea,t,1-t10.F405E46494C454008786F657F634D2874415F6D275577674
Runtime Name: vmhba33:C0:T0:L10
Device: t10.F405E46494C454008786F657F634D2874415F6D275577674
Device Display Name: OPNFILER iSCSI Disk (t10.F405E46494C454008786F657F634D2874415F6D275577674)
   Adapter: vmhba33
Channel: 0
Target: 0
LUN: 10

Plugin: NMP
State: active
Transport: iscsi
Adapter Identifier: iqn.1998-01.com.vmware:localhost-63cfb246
Target Identifier: 00023d000001,iqn.2006-01.com.openfiler:tsn.1a129a7adeea,t,1
Adapter Transport Details: iqn.1998-01.com.vmware:localhost-63cfb246
Target Transport Details: IQN=iqn.2006-01.com.openfiler:tsn.1a129a7adeea Alias= Session=00023d000001 PortalTag=1

Now I know the Runtime Name for LUN I want to hide. Then Issue esxcli storage core claimrule list to see what claimrules are configured by default.

~ # esxcli storage core claimrule list
Rule Class Rule Class Type Plugin Matches
———- —– ——- ——— ——— ———————————
MP 0 runtime transport NMP transport=usb
MP 1 runtime transport NMP transport=sata
MP 2 runtime transport NMP transport=ide
MP 3 runtime transport NMP transport=block
MP 4 runtime transport NMP transport=unknown
MP 101 runtime vendor MASK_PATH vendor=DELL model=Universal Xport
MP 101 file vendor MASK_PATH vendor=DELL model=Universal Xport
MP 65535 runtime vendor NMP vendor=* model=*

As you see from the output above there are some claimrules created by default. To create a new claimrule you need to give its rule number. Here is the available rule numbers.

  • Rules 0–100 are reserved for internal use by VMware.
  • Rules 101–65435 are available for general use. Any third party multipathing plugins installed on your system use claim rules in this range. By default, the PSA claim rule 101 masks Dell array pseudo devices. Do not remove this rule, unless you want to unmask these devices.
  • Rules 65436–65535 are reserved for internal use by VMware.

Once I find out about the RUN TIME information for the LUN then, I can create a claimrule to hide the LUN. You can use esxcli storage core claimrule add command to add a new rule. Note that I am using 201 as an example.

~ # esxcli storage core claimrule add -r 201 -t location -A vmhba33 -C 0 -T 0 -L 10 -P MASK_PATH

Run esxcli storage core claimrule list again to see if the rule is added. Note that a new create rule is created in file level but not in runtime level. This means that the rule is created but it is not in effect.

~ # esxcli storage core claimrule list
Rule Class Rule Class Type Plugin Matches
———- —– ——- ——— ——— —————————————-
MP 0 runtime transport NMP transport=usb
MP 1 runtime transport NMP transport=sata
MP 2 runtime transport NMP transport=ide
MP 3 runtime transport NMP transport=block
MP 4 runtime transport NMP transport=unknown
MP 101 runtime vendor MASK_PATH vendor=DELL model=Universal Xport
MP 101 file vendor MASK_PATH vendor=DELL model=Universal Xport
MP 201 file location MASK_PATH adapter=vmhba33 channel=0 target=0 lun=10
MP 65535 runtime vendor NMP vendor=* model=*

To active a new rule, you need to load claimrules to runtime class. Run esxcli storage core claimrule load to load claimrule into runtime.

~ # esxcli storage core claimrule load

Now a new claimrule that I created is in runtime and is in effect.

~ # esxcli storage core claimrule list
Rule Class Rule Class Type Plugin Matches
———- —– ——- ——— ——— —————————————-
MP 0 runtime transport NMP transport=usb
MP 1 runtime transport NMP transport=sata
MP 2 runtime transport NMP transport=ide
MP 3 runtime transport NMP transport=block
MP 4 runtime transport NMP transport=unknown
MP 101 runtime vendor MASK_PATH vendor=DELL model=Universal Xport
MP 101 file vendor MASK_PATH vendor=DELL model=Universal Xport
MP 201 runtime location MASK_PATH adapter=vmhba33 channel=0 target=0 lun=10
MP 201 file location MASK_PATH adapter=vmhba33 channel=0 target=0 lun=10

MP 65535 runtime vendor NMP vendor=* model=*

Now the claimrule is loaded, finally you will need to unclaim the all path used for the device and use new claimrule for the device. You need to use device ID for this. Since we already know the device ID of LUN from the esxcli storage core path list command that I previously issued.

~ #esxcli storage core claiming reclaim -dt10.F405E46494C454008786F657F634D2874415F6D275577674

If you run esxlistorage core path list the device that we are interested in is not listed.

~ #esxcli storage core path list | grept10.F405E46494C454008786F657F634D2874415F6D275577674
~ #

On vSphere Client, I don’t see LUN10 anymore

image

   Send article as PDF   

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Follow

Get every new post on this blog delivered to your Inbox.

Join other followers: