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.

B.3 Linux code<br />

end /* else */<br />

This section lists the code <strong>for</strong> the /usr/sbin/clone script that clones from a golden Linux<br />

image to a target virtual machine.<br />

#!/bin/sh<br />

#<br />

# clone.sh is a script that clones Linux images. It makes use of vmcp to<br />

# relay messages to the z/<strong>VM</strong> system and configuration files to modify<br />

# the new image once it has been cloned.<br />

#<br />

# <strong>The</strong> script reads in /etc/sysconfig/clone <strong>for</strong> user setting customizations.<br />

#<br />

# For details on how this script works see the book:<br />

# "z/<strong>VM</strong> and Linux on <strong>IBM</strong> System z: <strong>The</strong> <strong>Virtualization</strong> <strong>Cookbook</strong> <strong>for</strong> RHEL6"<br />

# on the Web at: http://www.redbooks.ibm.com/abstracts/sg247492.html<br />

#<br />

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

# THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS<br />

# OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY<br />

# WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY<br />

# OR FITNESS FOR A PARTICULAR PURPOSE.<br />

# NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY<br />

# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES<br />

# (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY<br />

# OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING<br />

# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR<br />

# DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED<br />

# HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES<br />

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

# <strong>The</strong>se MUST be lower case!<br />

MASTER_LINK=fffe<br />

CLONE_LINK=ffff<br />

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

function help<br />

# give help<br />

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

{<br />

echo "Usage: clone [-v] sourceID targetID [rootMinidisk [minidisk1 minidisk2..]]"<br />

echo " Switches"<br />

echo " -v Verbose output"<br />

echo " Required"<br />

echo " sourceID the z/<strong>VM</strong> user id you want to clone from"<br />

echo " targetID the z/<strong>VM</strong> user id you want to clone to"<br />

echo " Optional"<br />

echo " rootMinidisk the minidisk address that contains the root filesystem"<br />

echo " minidisk1..n additional minidisks that should be copied"<br />

exit<br />

}<br />

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

function cp_cmd<br />

# echo a CP command and invoke it via cp_cmd<br />

# Arg1-n: the z/<strong>VM</strong> command to issue<br />

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