27.12.2012 Views

The Virtualization Cookbook for SLES 10 SP2 - z/VM - IBM

The Virtualization Cookbook for SLES 10 SP2 - z/VM - IBM

The Virtualization Cookbook for SLES 10 SP2 - z/VM - IBM

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

}<br />

#+--------------------------------------------------------------------------+<br />

function link_disks<br />

# Call link_one to link each disk passed in as an argument.<br />

# Arg1-n: <strong>The</strong> minidisk address to link<br />

#+--------------------------------------------------------------------------+<br />

{<br />

[ -n "$VERBOSE" ] && echo "Linking minidisks <strong>for</strong> L<strong>VM</strong>..."<br />

while [ $# -gt 0 ]; do<br />

link_one $target_linux_id $1 400$# W<br />

set_online 400$#<br />

[ $? -eq 0 ] && echo "$1 disk linked ..."<br />

shift<br />

done<br />

}<br />

#+--------------------------------------------------------------------------+<br />

function unlink_disks<br />

# Call unlink_one to unlink each disk passed in as an argument.<br />

# Arg1-n: <strong>The</strong> minidisk address to unlink<br />

#+--------------------------------------------------------------------------+<br />

{<br />

[ -n "$VERBOSE" ] && echo "Unlinking minidisks ..."<br />

while [ $# -gt 0 ]; do<br />

set_offline 400$#<br />

unlink_one 400$#<br />

[ $? -eq 0 ] && echo "$1 disk unlinked ..."<br />

shift<br />

done<br />

}<br />

#+--------------------------------------------------------------------------+<br />

function ask_are_you_sure<br />

# Ask "Are you sure?" - if not, then exit<br />

#+--------------------------------------------------------------------------+<br />

{<br />

echo ""<br />

echo "This will copy disks from $source_linux_id to $target_linux_id"<br />

echo "Host name will be: $HOSTNAME"<br />

echo "IP address will be: $IPADDR"<br />

echo -n "Do you want to continue? (y/n): "<br />

read ans<br />

if [ $ans != "y" ]; then<br />

abort 1<br />

fi<br />

}<br />

#+--------------------------------------------------------------------------+<br />

function check_logged_off<br />

# Verify the user ID exists and is logged off<br />

# Arg1: <strong>The</strong> user id to query if it is logged on or not<br />

#+--------------------------------------------------------------------------+<br />

{<br />

cp_cmd QUERY $1<br />

case $? in<br />

0) # user ID is logged on or disconnected<br />

echo "$1 user ID must be logged off"<br />

exit 2<br />

;;<br />

Appendix B. Source code 257

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!