HP-UX vPars and Integrity VM V6.3 Administrator Guide

C Sample script for adding multiple devices
The following example provides a script that enables you to specify multiple storage devices at
once for a guest.
#!/bin/ksh
# ---------------------------------------------------------------------------------------
# HP Integrity VM example script.
#
# SUMMARY:
#
# Add disks to an Integrity VM (guest) in 'batch mode' with hpvmmodify, using AVIO.
#
# SYNOPSIS
#
# ./thisscript [-a] -P guestname -f disklistfile [-N #] [-n #] [-t #] [-qT] [-F flags]
# or
# ./thisscript -h | -H
#
# DESCRIPTION
#
# This is an example script of how to automate adding many disks to an
# Integrity VM guest using hpvmmodify, adding them as AVIO storage resources,
# adding them in 'batch mode', that is, adding multiple disks with a single
# call to hpvmmodify. When adding many disks, adding them in 'batch mode'
# provides a performance improvement over adding them one at a time (one
# disk added per hpvmmodify call).
#
# The disks to add are passed in as a filename that contains the list of
# disks. An example of how to generate this list is:
#
# # hpvmhostgdev -u -l | grep /dev/rdisk > disklistfile
#
# You may add all the disks in the disklistfile to a guest up to the supported
# limit of 1024, or some lesser number of disks (see -N flag), starting with the
# first disk in the disklistfile.
#
# By default, this script adds 10 disks per hpvmmodify command. You may
# change the 'batch add' number with the -n flag. The value of -n may be
# any value between 1 and 1024.
#
# Also by default, this script does not specify the virtual bus, device,
# target (b,d,t) triple in the hpvmmodify resource string. So the default
# limit of disks that may be added is 945. [The algorithm used by hpvmmodify
# default b,d,t assignment imposes this limit.]
#
# To add 946 to 1024 disks to a guest, hpvmmodify requires that the virtual
# bus, device, target (b,d,t) triple be specified in the resource string of
# the additional disks over 945. This script provides an option, -t, that
# causes the script to calculate and use explicit b,d,t values for all of
# the disks. The valid values for the -t option are 0 and 15-127. See
# below for more details on this option.
#
# This script only adds disks to guests when you specify the -a flag. If you
# omit the -a flag, this script will only print the messages that show what the
# hpvmmodify commands will be. You may suppress the sample hpvmmodify command
# messages with the -q flag.
#
# This script will time the hpvmmodify command with the timex command if
# you specify the -T command. [Note: timex output goes to stderr.]
#
# You may also specify other hpvmmodify command arguments by using the -F
# option. The options you chose should be specified as though you were
# typing them yourself on a commandline, using "-<flag>" or "-<flag> <value>",
# including the leading hypen (&apos;-&apos;). You must put the -F option value(s)
# in double quotes for this script to include them in the hpvmmodify command..
#
# WARNING: use the -F option at your own risk. Also, you
# must use -F option values that would work with
# hpvmmodify if you were entering the command on
# the commandline yourself.
#
# OPTIONS
#
# -a Add the disks (default is to only display what will be added)
#
# -F "arg(s)" Additional hpvmmodify options or flags (double quotes required)
#
# -f disklistfile File containing list of disks to add
#
# -h Print usage (help)
# -H Print usage (Help)
#
# -N # Number of devices to add from the disklistfile
#
# -n # Number of devices to add at one time (default: 10)
#
# -P guestname Name of Integrity VM (guest) to modify
#
281