Balance the load on vSCSI with dual VIO servers using AIX MPIO path priorities

VIO is a great technology that it saves a lot of time and headaches at a very low price from performance point of view.

However from vSCSI perspective, unless you change the path priorities (which manually is a painful process) one VIO server is idle from storage perspective. To avoid that the only thing you can do when using vSCSI is to change the path priorities.
The following script will do that for you. It defaults queue_depth to 20. Be careful with that, it is only “true” if you are using SVC disks. Check on your VIO servers what is the queue_depth you are getting with your particular storage. I might do a future version that the queue_depth is passed as a parameter.

Enjoy! Here comes the code:

#!/bin/ksh
#
#
# Purpose:
# This scripts changes all virtual disks parameters. To be used only if backing devices are LUN's from SAN
#
#
#------------------------------------------------------------------------
#
# Change History:
#
# Date Name Version Comments
#------------------------------------------------------------------------
# 2009-08-05 BLB 01.00.00 Initial release.
# 2010-02-17 BLB 01.00.01 Added queue_depth to 20 to match VIO hdisks on SDDPCM SVC
# 2011-09-20 BLB 02.00.00 Added path priority for DUAL VIO
#set -x
VIRTUALDISKS=`lsdev | grep "Virtual SCSI Disk Drive" | grep "Available" | awk '{print $1;}'`
echo "#--------------------------------------------------------------------------------------------------"
echo "#INFO: This script ONLY SHOWS the commands to change values at virtual disks backed with SAN LUN"
echo "#INFO: It DOES NOT perform ANY action."
echo "#WARNING: queue_depth 20 is only true for SVC disks using SDDPCM on the VIO, CHECK IT ON THE VIO!!!"
echo "#--------------------------------------------------------------------------------------------------"
echo
echo
echo "#INFO: Detected virtual disks are the following ones"
echo "#--------------------------------------------------------------------------------------------------"
echo "# "$VIRTUALDISKS
echo "#--------------------------------------------------------------------------------------------------"
echo
echo "#Commands to run under your own risk, please check the disks are correct"
echo "# START OF COMMANDS"
for vdisk in $VIRTUALDISKS;
do echo "chdev -l $vdisk -a hcheck_interval=60 -a hcheck_mode=nonactive -a queue_depth=20 -P";
for path in `lspath -l $vdisk -F'parent'`;
do DISKNUMBER=`echo $vdisk | awk '{sub("hdisk","")}; {print}'`;
PATHNUMBER=`echo $path | awk '{sub("vscsi","")}; {print}'`;
DISKPATH=`expr $DISKNUMBER + $PATHNUMBER`;
PRIONUM=`expr $DISKPATH % 2`;
PRIORITY=`expr $PRIONUM + 1`;
echo "chpath -l $vdisk -p $path -a priority=$PRIORITY";
done;
done;
echo "#END of commands"
echo "#--------------------------------------------------------------------------------------------------"
echo "#INFO: This script ONLY SHOWS the commands to change values at virtual disks backed with SAN LUN"
echo "#INFO: It DOES NOT perform ANY action."
echo "#WARNING: A reboot is needed to changes take effect after running the commands printed out here"
echo "#WARNING: queue_depth 20 is only true for SVC disks using SDDPCM on the VIO, CHECK IT ON THE VIO!!!"
exit 0

For checking that your dual VIO disks are OK, you can also do it using the following script:

#!/bin/ksh
#
#
# Purpose:
# This scripts changes lists virtual disks settings and looks for potential problems
#
#
#------------------------------------------------------------------------
#
# Change History:
#
# Date Name Version Comments
#------------------------------------------------------------------------
# 2011-09-21 BLB 01.00.00 Initial release.
#set -x
VIRTUALDISKS=`lsdev | grep "Virtual SCSI Disk Drive" | grep "Available" | awk '{print $1;}'`
ERROR=0;
echo "#----------------------------------------------------------------------------------------------------"
echo "#INFO: This script will look for virtual SCSI disks that do not have hcheck_mode or hcheck_interval"
echo "#configured correctly for dual VIO setups. It will also show you the path priorities and queue_depth."
echo "#It does NOT perform any corrective action. For those actions refer to tune_vdisks.sh on Nordix WIKI."
echo "#----------------------------------------------------------------------------------------------------"
echo "#INFO: Detected virtual disks are the following ones:"
echo "#----------------------------------------------------------------------------------------------------"
echo "# "$VIRTUALDISKS
echo "#----------------------------------------------------------------------------------------------------"
echo

for vdisk in $VIRTUALDISKS;

do HCHECK_INTERVAL=`lsattr -El $vdisk | grep “hcheck_interval” | awk ‘{print $2;}’`
HCHECK_MODE=`lsattr -El $vdisk | grep “hcheck_mode” | awk ‘{print $2;}’`
QUEUE_DEPTH=`lsattr -El $vdisk | grep “queue_depth” | awk ‘{print $2;}’`

echo “#INFO: Processing: “$vdisk;

if [ $HCHECK_INTERVAL -eq 60 ] ;
then echo “#INFO: hcheck_interval is 60 -> OK!”;
else echo “#ERROR!: hcheck_interval is “$HCHECK_INTERVAL” -> NOK!!!!!”;
$ERROR=$ERROR+1;
fi

if [ $HCHECK_MODE == "nonactive" ] ;
then echo “#INFO: hcheck_mode is nonactive -> OK!”;
else echo “#ERROR!: hcheck_mode is “$HCHECK_MODE” is NOK!!!!!”;
$ERROR=$ERROR+1;
fi

echo “#INFO: queue_depth is “$QUEUE_DEPTH”, has to be crosschecked with VIO settings”;

for path in `lspath -l $vdisk -F’parent’`;
do echo “#INFO: “$path” for disk ” $vdisk” : ”
PRIORITY=`lspath -OE -l $vdisk -p $path -a priority`;
echo $PRIORITY;
done;
echo “# INFO: END processing: “$vdisk;
echo;
done;
echo “#END of disks”
echo “#—————————————————————————————————-”
if [ $ERROR -eq 0 ] ;
then echo “#INFO: There were no ERRORS detected.”;
else echo “#ERROR: “$ERROR” detected. CHECK the output!”;
fi
echo “#—————————————————————————————————-”
exit 0

 

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>