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.

copy_key<br />

}<br />

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

function set_online<br />

# This will set online the target minidisk.<br />

# Arg1 - Minidisk virtual address to set online<br />

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

{<br />

local target_mdisk=$(echo $1 | tr 'A-Z' 'a-z')<br />

chccwdev -e 0.0.$target_mdisk >/dev/null<br />

rc=$?<br />

if [ $rc != 0 ]; then<br />

echo "Error: chccwdev -e 0.0.$target_mdisk failed with $rc - exiting"<br />

abort 1<br />

fi<br />

local target_dev_node=`cat /proc/dasd/devices | grep "$target_mdisk(ECKD)" | awk '{<br />

print $7 }'`<br />

if [ "$target_dev_node" = "" ]; then<br />

echo "Error: can't find $target_mdisk(ECKD) in /proc/dasd/devices - exiting"<br />

set_offline $target_mdisk<br />

abort 1<br />

fi<br />

# wait <strong>for</strong> disks<br />

$UDEVSETTLE<br />

}<br />

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

function set_offline<br />

# This will set offline the target minidisk.<br />

# Arg1 - Minidisk virtual address to set offline<br />

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

{<br />

target_mdisk=$(echo $1 | tr 'A-Z' 'a-z')<br />

chccwdev -d 0.0.$target_mdisk > /dev/null 2>&1<br />

rc=$?<br />

#if [ $rc -ne 0 ]; then<br />

# echo "Error: chccwdev -d 0.0.$1 failed with $rc - ignoring"<br />

#fi<br />

return $rc<br />

}<br />

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

function mount_cloned_image<br />

# This will mount the cloned root filesystem. It will pair a minidisk<br />

# address to a device file and then mount the first partition.<br />

# Arg1: <strong>The</strong> minidisk address to mount<br />

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

{<br />

target_mdisk=$1<br />

target_dev_node=`cat /proc/dasd/devices | grep "$target_mdisk(ECKD)" | awk '{ print $7<br />

}'`<br />

wait_<strong>for</strong>_device /dev/${target_dev_node}1<br />

Appendix B. Source code 259

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

Saved successfully!

Ooh no, something went wrong!