OpenSolaris

You are not signed in. Sign in or register.

LUN Mapping and Masking


The LUN Mapping and Masking operations involve 3 basic steps. Two of these are optional depending upon the requirements. The stmfadm command is used to carry out all of these steps.

  1. Define Host Group(s). A host group is a name given to a set of hosts (initiators) who are suppose to see the same set of LUNs. This step is not needed if all the hosts are going to see the same set of LUNs.
  2. Define Target Group(s). A target group is a name given to a set of target ports which are suppose to export the same set of LUNs to the same set of host groups. Again this step is optional if all the target ports on the system are going to export the same set of LUNs.
  3. For each Logical Unit, add one or more Views. A view has 4 components: Host group, Target group, LUN number and the Logical unit identifier. Adding a view is same as saying When any initiator from this host group, logs into any target port from this target group, it will see this Logical unit (represented by the LU identifier) as LUN number blah.

Out of the 4 components of the view entry, only the Logical Unit Identifier is required. Rest of the components can be omitted and will assume the default meaning as follows: If host group is omitted, All initiators will be assumed. If Target Group is omitted, All Targets will be assumed. If LUN number is omitted, the system will pick a suitable LUN number for the entry.

Examples of these steps are provided below. For more information on view entries, refer to this link

The following are some scenarios that show how COMSTAR logical units can be exported using the available LUN masking and mapping features of COMSTAR.

Scenario 1:

The logical unit with the LU Name "6000AE40C5000000000046FC4FEA000C" is to be made available to the two fibre channel ports on host-A.

1) The fibre channel port WWNs of the two fibre channel ports on host-A must be identified. In order to accomplish this, 'fcinfo' can be used:

# fcinfo hba-port
HBA Port WWN: 210000e08b83378d
        OS Device Name: /dev/cfg/c4
        Manufacturer: QLogic Corp.
        Model: QLA2462
        Firmware Version: 4.0.27
        FCode/BIOS Version: N/A
        Type: N-port
        State: online
        Supported Speeds: 1Gb 2Gb 4Gb 
        Current Speed: 4Gb 
        Node WWN: 200000e08b83378d
HBA Port WWN: 210100e08ba3378d
        OS Device Name: /dev/cfg/c5
        Manufacturer: QLogic Corp.
        Model: QLA2462
        Firmware Version: 4.0.27
        FCode/BIOS Version: N/A
        Type: N-port
        State: online
        Supported Speeds: 1Gb 2Gb 4Gb 
        Current Speed: not established 
        Node WWN: 200100e08ba3378d
#

2) With the port WWNs identified, these will now need to be added to a host group. This creates a set of initiator ports that will be used to export the logical unit. We'll call the host group "host-A". The following commands will create the host group and add the two initiator ports to the host group:

# stmfadm create-hg host-A
# stmfadm add-hg-member -g host-A wwn.210000e08b83378d wwn.210100e08ba3378d
# 

3) With the host group created, we're now ready to export the logical unit. This is accomplished by adding a view entry to the logical unit using this host group as shown in the following command:

# stmfadm add-view -h host-A 6000AE40C5000000000046FC4FEA000C
#

With the above steps completed, the logical unit should now be available from host-A.

# format
Searching for disks…done
AVAILABLE DISK SELECTIONS:
  1. c0t0d0 <DEFAULT cyl 14086 alt 2 hd 24 sec 424> /pci@0,0/pci1022,7450@2/pci1000,3060@3/sd@0,0
  2. c6t6000AE40C5000000000046FC4FEA000Cd0 <DEFAULT cyl 4175 alt 2 hd 255 sec 63> /scsi_vhci/disk@g6000ae40c5000000000046fc4fea000c
Specify disk (enter its number):

The device, c6t6000AE40C5000000000046FC4FEA000Cd0s2, is now available to be used from host-A.

Scenario 2:

Building on Scenario 1, a logical unit with the LU Name "6000AE40C5000000000046FC4FEA0001" is to be made available to the two fibre channel ports on host-A. But in this scenario, the logical unit will be exported to host-A with logical unit number 1.

1) Our host group, host-A, is already created. We now only need to add the appropriate view entry to the logical unit indicating that it should be made visible to host-A as logical unit number 1:

# stmfadm add-view -h host-A -n 1 6000AE40C5000000000046FC4FEA0001
#

With the above command completed successfully, the logical unit should now be visible to host-A as LUN 1 as shown in the following fcinfo command:

# fcinfo remote-port -p 210000e08b83378d -s
Remote Port WWN: 210000e08b8386cc
        Active FC4 Types: SCSI
        SCSI Target: yes
        Node WWN: 200000e08b8386cc
        LUN: 0
          Vendor: SUN
          Product: COMSTAR
          OS Device Name: /dev/rdsk/c6t6000AE40C5000000000046FC4FEA000Cd0s2
        LUN: 1
          Vendor: SUN
          Product: COMSTAR
          OS Device Name: /dev/rdsk/c6t6000AE40C5000000000046FC4FEA0001d0s2