Understand and apply LUN masking using PSA-related commands P1

We can mask:

· by path: (removing individual path visibility),

· by vendor (this will mask all LUNs to a specific vendor),

· by storage transport (yeah, like all iSCSI or all FC)

From <http://blog.mwpreston.net/2013/10/18/8-weeks-of-vcap-lun-masking/>

Part#1 LUN masking by Path:

-> I need to mask this LUN from 10.26.0.22 ESXi host only:

t10.F405E46494C45425A59347A6A5C6D213A57403D2E497A6A4

-> Double checking the device name:

-> Using Commands:

/var/log # esxcfg-mpath

-> List LUN paths

/var/log # esxcfg-mpath -L

vmhba32:C0:T0:L0 state:active mpx.vmhba32:C0:T0:L0 vmhba32 0 0 0 NMP active local ide.vmhba32 ide.0:0

vmhba1:C0:T1:L0 state:active mpx.vmhba1:C0:T1:L0 vmhba1 0 1 0 NMP active local pscsi.vmhba1 pscsi.0:1

vmhba33:C0:T0:L0 state:active t10.F405E46494C454256514C41787A4D266F69615D293F666E6 vmhba33 0 0 0 NMP active san iqn.1998-01.com.vmware:ESX02-48f816e4 00023d000001,iqn.2006-01.com.openfiler:tsn.904062595734,t,1

vmhba33:C0:T0:L1 state:active t10.F405E46494C4542564F6F6154547D22436E646D2474705D6 vmhba33 0 0 1 NMP active san iqn.1998-01.com.vmware:ESX02-48f816e4 00023d000001,iqn.2006-01.com.openfiler:tsn.904062595734,t,1

vmhba33:C0:T0:L2 state:active t10.F405E46494C45425A59347A6A5C6D213A57403D2E497A6A4 vmhba33 0 0 2 NMP active san iqn.1998-01.com.vmware:ESX02-48f816e4 00023d000001,iqn.2006-01.com.openfiler:tsn.904062595734,t,1

vmhba1:C0:T0:L0 state:active mpx.vmhba1:C0:T0:L0 vmhba1 0 0 0 NMP active local pscsi.vmhba1 pscsi.0:0

-> 2 Ways to filter the required LUN :

-> Create claim rule (to assign each of the LUN’s paths to the MASK_PATH plug-in

esxcli storage core claimrule add –rule 250 -t location -A vmhba33 -C 0 -T 0 -L 2 -P MASK_PATH

Please note the switches below to understand the above command

-> load the new rule:

esxcli storage core claimrule load

-> unclaim all the LUN’s paths from the currently assigned plug-in and reclaim the paths on the newly assigned plug-in.

esxcli storage core claiming reclaim -d t10.F405E46494C45425A59347A6A5C6D213A57403D2E497A6A4

esxcli storage core claiming unclaim -d t10.F405E46494C45425A59347A6A5C6D213A57403D2E497A6A4 -t location

esxcli storage core claimrule run

-> Rescan to make sure the LUN is not presented to the host

esxcli storage core adapter rescan –all

Now the host can not detect the LUN:

Let us check the another host:

The Last one:

So before the Masking on the 10.26.0.222 host I was able to view the MaskMe Lun:

Now:

 

 

-> Rolling back

~ # esxcli storage core claimrule remove -r 250
~ # esxcli storage core claimrule load
~ # esxcli storage core claiming unclaim -t location -A vmhba33 -C 0 -T 0 -L 2
~ # esxcli storage core adapter rescan -A vmhba33
~ #  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            200  runtime  location   MASK_PATH  adapter=vmhba33 channel=0 target=0 lun=0
MP            200  file     location   MASK_PATH  adapter=vmhba33 channel=0 target=0
lun=0
MP          65535  runtime  vendor     NMP        vendor=* model=*

~ #  esxcli storage filesystem list
Mount Point                                        Volume Name  UUID
Mounted  Type             Size           Free
————————————————-  ———–  ———————————–  ——-  ——  ————-  ————-

/vmfs/volumes/54f2a5a9-83586347-24b0-005056ba5d3d  DS-ISCSI01   54f2a5a9-83586347-24b0-005056ba5d3d     true  VMFS-5    51002736640    13444841472

/vmfs/volumes/54f2a852-0371a01a-22f8-005056ba5d3d  LOCALds-222  54f2a852-0371a01a-22f8-005056ba5d3d     true  VMFS-5    24159191040    23181918208

/vmfs/volumes/54f29c47-383dad5e-be22-005056ba2aa3  DS-ISCSI0    54f29c47-383dad5e-be22-005056ba2aa3     true  VMFS-5  1048508891136  1047482335232

/vmfs/volumes/550750a1-b0f04e34-04a3-005056ba5d3d  MaskMe       550750a1-b0f04e34-04a3-005056ba5d3d     true  VMFS-5    40265318400    39246102528

/vmfs/volumes/54e2243d-1bfef8d4-0132-005056ba5d3d               54e2243d-1bfef8d4-0132-005056ba5d3d     true  vfat       4293591040     4258791424

/vmfs/volumes/4430fa78-c7dcc688-5dd3-b5da4fe0e3f1               4430fa78-c7dcc688-5dd3-b5da4fe0e3f1     true  vfat        261853184       78295040

/vmfs/volumes/b9a7427a-7abc96b1-a469-1c827a6f3215               b9a7427a-7abc96b1-a469-1c827a6f3215     true  vfat        261853184       94564352

/vmfs/volumes/54e22435-e0e2f6b5-1045-005056ba5d3d               54e22435-e0e2f6b5-1045-005056ba5d3d     true  vfat        299712512       97705984

 

 

Advertisements

About Ahmad Sabry ElGendi

https://www.linkedin.com/pub/ahmad-elgendi/94/223/559
This entry was posted in Objective 1.1 – Implement Complex Storage Solutions, Section 1 – Implement and Manage Storage, VCAP5-DCA, Vmware. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s