Friday, February 22, 2013

How to find vhost assigned to a particular VIO Client?


How to find vhost assigned to a particular VIO Client?


Method 1:      


Using two commands/steps we can easily find out the vhost information of the particular disk.


login to the vio client, and find out the disk's slot number ( for ex: hdisk1) 
                
         Command:>  lscfg|grep hdisk1 
        Output:>       hdisk1   U9133.55A.065040H-V21-C19  Virtual SCSI Server Adapter


login to the vio server and execute the below command to find out the vhost information of the particular disk.

                          Command:>  lsdev -slots|grep C19
                            Output:>    vhost3

Using the above output we can confirm that the vhost3 is assigned to the hdisk1.



--------------------------------------------------------------------------------------------------------------------------



Method 2:      


* Find the lpar id and convert into hexa decimal.

     For ex: if your LPAR ID is 15, then the hexadecimal value is "f"  

Using the below command we can convert decimal no to hexa-decimal.


    printf "%x\n" 15           
output is: "f"


 * Execute the below command on the VIO server to find out the vhost info.

     lsmap -all | grep vhost | grep 0x0000000f


Note: totally 6 zeros are needs to put after the "x" on the command and last two digit ("0f") is for hexa decimal number.

Advantages of this command is, if you have 6 virtual disks on the lpar from the vios, then we  will get all the 6 virtual disks associated with the vhosts name on the VIOS..

--------------------------------------------------------------------------------------------------------------------------

Method 3


Using kdb, we can easily trace the vscsi configuration in aix. This command will save much time when we compare with the old method to do the same.

In the old method, We can find out the slot number (like C13 or C14) of vscsi in the client server, after that login to the vio server and find out the appropriate vhost information for the vscsi.


#echo "cvai" | kdb | grep vscsi

read vscsi_scsi_ptrs OK, ptr = 0x59A03C0
vscsi0 0x000007 0x0000000000 0x0 vios1->vhost8
vscsi1 0x000007 0x0000000000 0x0 vios2->vhost8


Using above command from the client server to find out the appropriate VHOST information for our VSCSI and the name of the VIO servers as well.



--------------------------------------------------------------------------------------------------------------------------

Method 4:


Login to the lpar and get into the VG and make note of the PVID of the disk. Now login to the VIO Server and get the disk name using the PVID.  now we can able to get the appropriate vhost name with the corresponding disk name like below.

lpar

# lspv  --> To get the pvid of the disk


Vio server:

lspv|grep -i <pvid>        --> To get the disk name
lsmap -all|grep -p <disk name>   --> To get the VTD name

lsdev -dev <VTD name> -field parent   --> We can get the vhost name



--------------------------------------------------------------------------------------------------------------------------

Method 5:


As per Target's standard VTD naming convention, VTD name will contain the VIO client name & LUN ID of the disk used for backing device. So we can run a lsmap -all | more and find the VTD with VIO Client we are searching for. Below output shows that vhost3 is the Server SCSI adapter for VIO Client "testmachine"


$ lsmap -all | more
Physloc               U7311.D20.067DDBB-P1-C02-T1-L23

VTD                   esvdevcmsweb-42e
Status                Available
LUN                   0x9500000000000000
Backing device        hdiskpower16
Physloc               U7311.D20.067DDBB-P1-C02-T1-L19

SVSA            Physloc                                      Client Partition ID
--------------- -------------------------------------------- ------------------
vhost3          U9133.55A.065040H-V22-C16                    0x00000003

VTD                   testmachine-16
Status                Available
LUN                   0x8700000000000000
Backing device        hdiskpower54
Physloc               U7311.D20.067DDBB-P1-C02-T1-L113

VTD                   testmachine-15
Status                Available
LUN                   0x9200000000000000
Backing device        hdiskpower30
Physloc               U7311.D20.067DDBB-P1-C02-T1-L66