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.

shift<br />

fi<br />

# If no command line options were provided show the help message<br />

[ $# -eq 0 ] && help<br />

# If one comand line option was provided show the help message<br />

if [ $# -lt 2 ]; then<br />

echo "Error: incorrect number of arguments"<br />

help<br />

fi<br />

# Check that vmcp exists and the module is loaded<br />

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

# Allow UPPER or lower case source, target, blacklist entries.<br />

# Convert all to lower case <strong>for</strong> consistency.<br />

source_linux_id=$(echo $1 | tr "[:upper:]" "[:lower:]")<br />

target_linux_id=$(echo $2 | tr "[:upper:]" "[:lower:]")<br />

# Check the blacklist, which prevents using the master image as a target.<br />

if [ -f /etc/clone/blacklist.conf ]; then<br />

. /etc/clone/blacklist.conf<br />

BlackList=$(echo ${BLACKLIST} | tr "[:upper:]" "[:lower:]")<br />

<strong>for</strong> Target in ${BlackList}<br />

do<br />

if [ "${Target}" == "${target_linux_id}" ]; then<br />

echo "${target_linux_id} is blacklisted! Exiting!"<br />

exit<br />

fi<br />

done<br />

fi<br />

# Check if udevsettle is present, used in function wait_<strong>for</strong>_device<br />

[ -x /sbin/udevsettle ] && UDEVSETTLE=/sbin/udevsettle<br />

[ -x /sbin/udevadm ] && UDEVSETTLE='/sbin/udevadm settle'<br />

# Check that the master and clone z/<strong>VM</strong> IDs are logged off.<br />

check_logged_off $source_linux_id<br />

check_logged_off $target_linux_id<br />

# Check that the clone's configuration file exists<br />

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

# Collect in<strong>for</strong>mation from the clone's configuration file<br />

get_target_info $@<br />

[ "$PROMPT" = "y" ] && ask_are_you_sure<br />

echo "Cloning $source_linux_id to $target_linux_id ..."<br />

[ -z "$DASD" ] && echo "Error: no DASD defined in /etc/clone/${target_linux_id}.conf" &&<br />

exit<br />

copy_disks $DASD<br />

# Update the newly cloned image locally, so link, set online then mount the<br />

# clone's root filesystem. <strong>The</strong>n call modify_cloned_image to update<br />

# configuration files with the proper settings. Finally unmount,<br />

# set offline and unlink the disk.<br />

echo "Updating cloned image ..."<br />

if [ -n "$VG_NAME" ]; then<br />

link_disks $DASD<br />

262 <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!