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.

[ $? -ne 0 ] && echo "Error: timed out waiting <strong>for</strong> /dev/${target_dev_node}1" && abort<br />

1<br />

}<br />

/bin/mount /dev/${target_dev_node}1 $CLONE_MNT_PT<br />

[ $? -ne 0 ] && echo "Error: unable to mount cloned image" && abort 1<br />

/bin/mount | grep /dev/${target_dev_node}1 >/dev/null 2>&1<br />

[ $? -ne 0 ] && echo "Error: unable to mount cloned image" && abort 1<br />

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

function mount_cloned_image_lvm<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 />

}<br />

/bin/mount /dev/$VG_NAME/$LV_ROOT $CLONE_MNT_PT<br />

[ $? -ne 0 ] && echo "Error: unable to mount cloned image" && abort 1<br />

/bin/mount | grep $LV_ROOT >/dev/null 2>&1<br />

[ $? -ne 0 ] && echo "Error: unable to mount cloned image" && abort 1<br />

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

function umount_cloned_image<br />

# Unmount the cloned root filesystem<br />

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

{<br />

/bin/umount $CLONE_MNT_PT >/dev/null 2>&1<br />

return $?<br />

}<br />

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

function check_<strong>for</strong>_conf<br />

# Check that the configuration file exists <strong>for</strong> the ID that we are cloning to.<br />

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

{<br />

if [ ! -f /etc/clone/${target_linux_id}.conf -a "$PROMPT" != "y" ]; then<br />

echo "Error: /etc/clone/${target_linux_id}.conf not found. Exiting"<br />

exit<br />

fi<br />

}<br />

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

function check_<strong>for</strong>_vmcp<br />

# Check that the vmcp module is loaded and the vmcp binary is installed.<br />

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

{<br />

# Check that vmcp exists and is executable<br />

[ ! -x /sbin/vmcp ] && echo "Error: can't find /sbin/vmcp" && exit<br />

# Load the vmcp kernel module if not already loaded<br />

if ! /sbin/lsmod | grep vmcp > /dev/null 2>&1 ; then<br />

if ! /sbin/modprobe vmcp > /dev/null 2>&1 ; then<br />

260 <strong>The</strong> <strong>Virtualization</strong> <strong>Cookbook</strong> <strong>for</strong> RHEL 6

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

Saved successfully!

Ooh no, something went wrong!