Tuesday, 17 July 2012

VIRTUAL SCSI ( VSCSI ) and Virtual Disk Setup


Virtual SCSI is based on a client and server relationship. The Virtual I/O Server owns the physical resources and acts as server, or target, device. Physical adapters with attached disks on the Virtual I/O Server partition may be shared by one or more partitions. These partitions contain a virtual SCSI client adapter that sees these virtual devices as standard SCSI compliant devices and LUNs.
Physical disks presented to the Virtual I/O Server can be assigned to a client partition in a number of different ways using Virtual SCSI :
Logical Volume based Virtual Disk
  1. Create Storage Pool.
  2. Create Logical Volume ( LV).
  3. Map LV to Client LPAR .
File Base Virtual Disk
  1. Create File based Storage Pool.
  2. Create File.
  3. Map File to Client LPAR.
Whole Disk/LUN based Virtual Disk
  1. Map Disk to Client LPAR
Procedure to assign a disk from VIO server to Client
On HMC create and connect Virtual SCSI Adatper devices  as below steps and after it  we will have a server-client mapping like in Figure 1 as below
1. Create the Virtual SCSI server adapterHMC -> VIO Server (VIOS1) -> DLPAR -> Virtual Adapters -> Action -> Create -> SCISI adapterI have Filled up the following parameters as per Figure 1 Adapter : 3
Checked the box for “This adapter is required for partition activationServer Partition : VIOS1( I selected VIOS1 server)
Server Adapter ID : 12  ( This is the slot C12 and it is associated with Client 1 ( webmanual01)
We need to update same for Client 2 and Client 3 with slot 13 and 14
2. Modify  the profile of VOI server  (VIOS1) accordingly for next reboot . We can be updated it by : Configuration -> Managed Profile -> Select the Profile -> Action Edit -> Virtual  Adapters -> Action -> Create -> SCISI adapterI have Filled up the following parameters as per Figure 1 Adapter : 12
Checked the box for “Only Selected Client Partition to ConnectClient Partition :  webmanual01 ( I selected Client partition)
Server Adapter ID : 3 ( This is the slot C12 and it is associated with Client 1 ( webmanual01)
We need to update same for Client 2 and Client 3 with slot 13 and 14 and Client partition slot 3
3. Create the Virtual SCSI client adapter HMC -> VIO Client (webmanual01) -> DLPAR -> Virtual Adapters-> Action -> Create -> SCISI adapterI have Filled up the following parameters as per Figure 1 Adapter : 12
Checked the box for “Only Selected Client Partition to ConnectClient Partition :  webmanual01( I selected Client partition)
Server Adapter ID : 3( This is the slot C12 and it is associated with Client 1 ( webmanual01)
We need to update same for Client 2 and Client 3 with Server slot 13 and 14 and Client partition slot 3
4. Modify the profile accordingly for next reboot . We can be updated it by : Configuration -> Managed Profile -> Select the Profile -> Action Edit -> Virtual  Adapters -> Action -> Create -> SCISI adapterI have Filled up the following parameters as per Figure 1 Adapter : 3
Checked the box for “This adapter is required for partition activationServer Partition : VIOS1( I selected VIOS1 server)
Server Adapter ID : 12  ( This is the slot C12 and it is associated with Client 1 ( webmanual01)
We need to update same for Client 2 and Client 3 with slot 13 and 14
5. Run cfgdev on VIO server and it will bring up vhostX on VIO server in our example it is vhost0, vhost1 and vhost2
6. Run cfgmgr on VIO client webmanual01 and it will bring up vscsiX on client in our example it is vscsi0,vscsi1 and vscsi2

Figure 1
For Dual VIO set perform Step 1 to Step 5 on VIOS2 . In Figure 1 , we have created three Virtual SCSI adapter vhost0 , vhost1 and vhost3 with slot C12 , C13 and C14 for Client 1 , Client 2 and Client 3 respectively. Here Client 1 = webmanual01 , Client 2 = webmanual02 and Client 3 = webmanual03.
Now checking adapter mappings between VIO server and client:
On vio VIOS1:
To display all I/O slots that are not hot-pluggable but can have DLPAR operations performed on them, type:
lsdev -slots
The system displays a message similar to the following:
U787A.001.DNZ00Y1-P1-C1  Logical I/O Slot  pci4 sisscsia0
U787A.001.DNZ00Y1-P1-T5  Logical I/O Slot  pci3 ent0 ent1
U9133.55A.10DFD8C-V2-C12  Virtual I/O Slot  vhost0  
U9133.55A.10DFD8C-V2-C13  Virtual I/O Slot  vhost1 
U9133.55A.10DFD8C-V2-C14  Virtual I/O Slot  vhost2
Below command will give vhostX and corresponding slot now
padmin@VIOS1 :  lsdev -dev vhost0 -vpd
vhost0           U9133.55A.062509H-V2-C12  Virtual SCSI Server Adapter
On client webmanual01:
root@webmanual01: /root # lscfg -vpl vscsi0

vscsi0           U8204.E8A.0680E82-V4-C12-T1  Virtual SCSI Client Adapter
On both vio and client, in the location path th slot CX (here C12) is identical means client adapter vscsi0 is connected server adapter vhost0
 Disk assignments:
Using physical disks:
mkvdev -vdev hdisk3 -vadapter vhost0 -dev  webmanual01_disk
The above command mapping hdisk3 to vhosto  and now  client server  can access hisk3 through vscsi0.  Note the hdisk number might be changed on client.
Using logical volumes:
Create a Storage Pool

mksp  myvg_vios hdisk3
List the VG
lsvg
Creating lv to  mapped to client
mklv -lv lv_client  myvg_vios  10G
Lists lvs under a vg  
lsvg -lv myvg_vios
Now map the LV to client server
mkvdev -vdev  lv_client  -vadapter vhost1 -dev webmanual02_lv
The above command will map lv_client to vhosto  and now  client server  can access lv_client through vscsi0.
Using file backed storage pool
Create a Storage Pool
mksp my_pool hdik3
Creates a file backed storage pool in the storage pool .
mksp -fb my_fb  -sp my_pool  -size 20G
it wil look like an lv, and a fs will be created automatically as well
List the storage pool
lssp
Check the file by using command
#mount
To create a file backed device and assigns it to the given vhost
mkbdsp -sp fb_testvg -bd my_fb -vadapter vhost2 -tn client_sp 10G
Now map the file to client server
mkvdev -vdev  fb_testvg  -vadapter vhost2 -dev webmanual03_fb

Figure 2
 On Dual VIOS setup Configuration will be like Figure 3 as below

Figure 3
Some other Virtual SCSI useful commands
To Remove an assignment to the client
rmvdev -vdev
To Remove the given file storage pool
rmsp

 * Source Article from : Internet