7.5.2. Assignment of Virtual Target Devices (Mapping)

In order for storage to be accessible in the client LPAR by a virtual SCSI client adapter, the storage must first be assigned to the associated virtual SCSI server adapter on the virtual I/O server (VSCSI mapping). This chapter deals with the mapping of disks and logical volumes; the possibility of assigning files is discussed separately later (chapter 8: Virtual I/O Server).

The virtual SCSI server adapters available on a virtual I/O server can be displayed using the command “vios lsvscsi” (list VSCSI):

$ vios lsvscsi ms03-vio1
SVSA    SLOT  CLIENT    LUNS
vhost0  C33   aix22(5)  0
$

The command shows all virtual SCSI server adapters, together with the virtual slot number of the adapter and the name of the associated client LPAR. The number of assigned virtual target devices is specified in the LUNS column. The device name of the virtual SCSI server adapter on the virtual I/O servers is vhost with a consecutive number.

In addition to the vhost adapter to which a device is to be mapped, one needs also at least one available device that can be assigned (disk or logical volume). The physical volumes present on a virtual I/O server can be displayed with the command “vios lspv” (list physical volumes):

$ vios lspv ms03-vio1
PVNAME  PVID              VGNAME  PVSTATE
hdisk0  00dead00beef0003  None    -
hdisk1  00dead00beef0005  rootvg  active
hdisk2  00dead00beef0008  rootvg  active
hdisk3  00dead00beef000e  None    -
hdisk4  00dead00beef0001  None    -
$

In addition to the two physical volumes hdisk1 and hdisk2 of the rootvg, there are three other physical volumes, that are currently not in use. We use hdisk0 as an example for a VSCSI mapping.

Note: For physical volumes that are to be mapped to a vhost adapter, the disk attribute reserve_policy should be set to no_reserve. This can be done with the command “vios chdev”:

$ vios chdev ms03-vio1 hdisk0 reserve_policy=no_reserve
$ vios chdev ms03-vio1 hdisk3 reserve_policy=no_reserve
$ vios chdev ms03-vio1 hdisk4 reserve_policy=no_reserve
$

If an external disk (LUN) is mapped from more than one virtual I/O server, this is absolutely necessary, otherwise the first virtual I/O server reserves the disk (SCSI reservation) and the other virtual I/O servers cannot access the disk.

The mapping itself can be carried out using the command “vios map” (map SCSI target device). At least the device to be mapped and the vhost adapter must be specified:

$ vios map ms03-vio1 hdisk0 vhost0
$

The VSCSI mapping creates a child device of the virtual SCSI server adapter vhost0. By default, the child device has the name vtscsi with a consecutive unique number. Figure 7.15 shows the disks as child devices of the SAS adapter sas0 or the FC protocol device fscsi4 and the virtual target device vtscsi0 as a child device of the virtual SCSI server adapter vhost0. The assignment to disk hdisk0 as a so-called backing device takes place via the attribute aix_tdev of vtscsi0, which refers to disk hdisk0.

Mapping of hdisk0 to the adapter vhost0
Figure 7.15: Mapping of hdisk0 to the adapter vhost0.

In the same way, further devices can be added to the adapter vhost0 and thus to the associated virtual SCSI client adapter. A short check of the virtual SCSI server adapter shows that a LUN is now assigned to the adapter vhost0:

$ vios lsvscsi ms03-vio1
SVSA    SLOT  CLIENT    LUNS
vhost0  C33   aix22(5)  1
$

Of course, the assigned LUNs can also be displayed. All you have to do, is to specify one of the vhost adapters as a further argument:

$ vios lsvscsi ms03-vio1 vhost0
VTD      STATUS     BACKING  BDPHYSLOC  MIRRORED  LUN
vtscsi0  Available  hdisk0   -          N/A       0x8100000000000000
$

During the mapping, a new virtual device (vtscsi0) is created as a child of the virtual SCSI server adapter vhost0:

$ vios lsdev ms03-vio1 vtscsi0
NAME     STATUS     PHYSLOC                      PARENT  DESCRIPTION
vtscsi0  Available  U9009.22A.8991971-V1-C33-L1  vhost0  Virtual Target Device - Disk
$

The device has the following attributes:

$ vios lsattr ms03-vio1 vtscsi0
ATTRIBUTE        VALUE               DESCRIPTION                          USER_SETTABLE
LogicalUnitAddr  0x8100000000000000  Logical Unit Address                 False
aix_tdev         hdisk0              Target Device Name                   False
allow520blocks   yes                 Allow 520-byte blocks, if supported  False
client_reserve   no                  Client Reserve                       True
mig_name                             N/A                                  True
mirrored         false               Metro/Global Mirror                  True
$

When the virtual target device is created with the “vios map” command, the aix_tdev attribute is set to the specified target of the mapping (here hdisk0). The attribute cannot be changed after it has been created (column USER_SETTABLE has value False).

In order for the “new” disk to be available on the client, the config manager cfgmgr must be started under AIX:

aix22 # cfgmgr -l vscsi0 -v
----------------
Attempting to configure device 'vscsi0'
Time: 0 LEDS: 0x25b3
Invoking /usr/lib/methods/cfg_vclient -l vscsi0
Number of running methods: 1
----------------
Completed method for: vscsi0, Elapsed time = 0
Return code = 0
***** stdout *****
hdisk9
*** no stderr ****
----------------
Time: 0 LEDS: 0x539
Number of running methods: 0
----------------
Attempting to configure device 'hdisk9'
Time: 0 LEDS: 0x25b4
Invoking /etc/methods/cfgscsidisk -l hdisk9
Number of running methods: 1
----------------
Completed method for: hdisk9, Elapsed time = 1
Return code = 0

aix22 #

(Using the option “-l vscsi0” the config manager was instructed to re-scan the device subtree starting with the device vscsi0.)

In the output of cfgmgr you can see that the physical volume hdisk9 has been recognized. The physical volume is of type “Virtual SCSI Disk Drive“:

aix22 # lscfg -l hdisk9
  hdisk9           U9009.22A.8991971-V5-C11-T1-L8100000000000000  Virtual SCSI Disk Drive
aix22 #

The assignment to the corresponding virtual target device on the virtual I/O server can be seen from the physical location code. The part “V5-C11-T1” is the virtual slot 11 of the LPAR, where the virtual SCSI client adapter has been created. The last part “L8100000000000000” specifies the LUN ID, that is the value of the LogicalUnitAddr attribute of the virtual target device vtscsi0 on the virtual I/O server.

Device trees on virtual I/O server and client LPAR and the I/O path.
Figure 7.16: Device trees on virtual I/O server and client LPAR and the I/O path.

Figure 7.16 shows the part of the device trees relevant for VSCSI on the virtual I/O server and the client LPAR. The I/O path, when accessing a VSCSI LUN (hdisk9), is also shown on the client LPAR.

The default name vtscsi0 for the virtual target device gives no indication to which client it is assigned to. With a few hundred VSCSI mappings, it can be advantageous to give a virtual target device a descriptive name, that indicates which client the device belongs to and possibly which device (hdisk) it corresponds to on the client. When mapping with “vios map“, a device name for the virtual target device can optionally be specified. In the following example, the logical volume lv00 is assigned to the virtual SCSI server adapter vhost0, whereby the name aix22_hd01 is given to the created virtual target device:

$ vios map ms03-vio1 lv00 vhost0 aix22_hd01
$

The logical volume must already exist before the mapping, it is not created by the mapping! The client LPAR aix22 has now assigned 2 devices:

$ vios lsvscsi ms03-vio1 vhost0
VTD         STATUS     BACKING  BDPHYSLOC  MIRRORED  LUN
aix22_hd01  Available  lv00     -          N/A       0x8200000000000000
vtscsi0     Available  hdisk0   -          N/A       0x8100000000000000
$

Another run of the config manager is necessary on the AIX LPAR for AIX to recognize the new device.

Note: If logical volumes or files are to be assigned as backing devices (target of the virtual target device), it is much more convenient to use storage pools. These are discussed in detail in a separate subsection in chapter 8.