From f29c2dae87dcdcdb7ed2d61c37347c4c49671991 Mon Sep 17 00:00:00 2001 From: steve Date: Fri, 17 Feb 2006 07:30:27 +0000 Subject: [PATCH] 2006-02-17 07:30:27 by steve Made the creation of the Xen configuration file simpler with regards to disk images. --- xen-create-image | 36 +++++++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/xen-create-image b/xen-create-image index feb73d8..a7dbd4d 100755 --- a/xen-create-image +++ b/xen-create-image @@ -351,7 +351,7 @@ Install an X11 server, using VNC and XDM -- http://www.steve.org.uk/ - $Id: xen-create-image,v 1.92 2006-02-16 19:24:38 steve Exp $ + $Id: xen-create-image,v 1.93 2006-02-17 07:30:27 steve Exp $ =cut @@ -561,19 +561,39 @@ print "\n"; # # The two images we'll use, one for the disk image, one for swap. # -my $image; -my $swap; +my $image = ""; +my $swap = ""; +my $image_vbd = ""; +my $swap_vbd = ""; if ( $CONFIG{'volume'} ) { + # + # Images upon the LVM system. + # $image = "/dev/" . $CONFIG{'volume'} . "/" . $CONFIG{'hostname'} . '-root'; $swap = "/dev/" . $CONFIG{'volume'} . "/" . $CONFIG{'hostname'} . '-swap'; + + # + # Images as presented to Xen. + # + $image_vbd = "phy:${CONFIG{'volume'}}/${CONFIG{'hostname'}}-root"; + $swap_vbd = "phy:${CONFIG{'volume'}}/${CONFIG{'hostname'}}-swap"; } elsif ( $CONFIG{'dir'} ) { + # + # Images upon the filesystem. + # $image = $CONFIG{'dir'} . '/domains/' . $CONFIG{'hostname'} . "/disk.img" ; $swap = $CONFIG{'dir'} . '/domains/' . $CONFIG{'hostname'} . "/swap.img" ; + + # + # Images as presented to Xen. + # + $image_vbd = "file:" . $image; + $swap_vbd = "file:" . $swap; } else { @@ -760,14 +780,8 @@ memory = $CONFIG{'memory'} name = "$CONFIG{'hostname'}" root = "/dev/sda1 ro" vif = [''] +disk = [ '${image_vbd},sda1,w', '${swap_vbd},sda2,w' ] E_O_XEN -if ( $CONFIG{'dir'} ) -{ - print XEN "disk = [ 'file:$image,sda1,w','file:$swap,sda2,w' ]\n"; -} -if ( $CONFIG{'volume'} ) -{ - print XEN "disk = [ 'phy:$CONFIG{'volume'}/$CONFIG{'hostname'}-root{,sda1,w','phy:$CONFIG{'volume'}/$CONFIG{'hostname'}-swap,sda2,w' ]\n"; } if ( $CONFIG{'dhcp'} ) { @@ -960,7 +974,7 @@ sub parseCommandLineArguments if ( $VERSION ) { - my $REVISION = '$Revision: 1.92 $'; + my $REVISION = '$Revision: 1.93 $'; if ( $REVISION =~ /1.([0-9.]+) / ) {