2006-06-20 23:06:05 by steve
The --force flag will now delete + recreate LVM volumes if they were already present - giving a similar result to the same flag on loopback images.
This commit is contained in:
@@ -432,7 +432,7 @@ Install an X11 server, using VNC and XDM
|
|||||||
--
|
--
|
||||||
http://www.steve.org.uk/
|
http://www.steve.org.uk/
|
||||||
|
|
||||||
$Id: xen-create-image,v 1.36 2006-06-20 22:48:35 steve Exp $
|
$Id: xen-create-image,v 1.37 2006-06-20 23:06:05 steve Exp $
|
||||||
|
|
||||||
=cut
|
=cut
|
||||||
|
|
||||||
@@ -844,7 +844,7 @@ sub parseCommandLineArguments
|
|||||||
|
|
||||||
if ( $VERSION )
|
if ( $VERSION )
|
||||||
{
|
{
|
||||||
my $REVISION = '$Revision: 1.36 $';
|
my $REVISION = '$Revision: 1.37 $';
|
||||||
|
|
||||||
if ( $REVISION =~ /1.([0-9.]+) / )
|
if ( $REVISION =~ /1.([0-9.]+) / )
|
||||||
{
|
{
|
||||||
@@ -1172,16 +1172,52 @@ sub createLoopbackImages
|
|||||||
|
|
||||||
sub createLVMBits
|
sub createLVMBits
|
||||||
{
|
{
|
||||||
#
|
# The two volumes we will need to use..
|
||||||
# The two volumes we will need to use..
|
my $disk = $CONFIG{'hostname'} . "-disk" ;
|
||||||
#
|
my $swap = $CONFIG{'hostname'} . "-swap" ;
|
||||||
my $disk = $CONFIG{'hostname'} . "-disk" ;
|
|
||||||
my $swap = $CONFIG{'hostname'} . "-swap" ;
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# TODO: Check whether the volumes exist, and if so abort
|
# Check whether the disk volume exists already, and if so abort
|
||||||
# unless '--force' is specified.
|
# unless '--force' is specified.
|
||||||
#
|
#
|
||||||
|
my $lvm_disk = "/dev/$CONFIG{'lvm'}/$CONFIG{'hostname'}-disk";
|
||||||
|
if ( -e $lvm_disk )
|
||||||
|
{
|
||||||
|
# Delete if forcing
|
||||||
|
if ( $CONFIG{'force'} )
|
||||||
|
{
|
||||||
|
runCommand( "lvremove --force $lvm_disk" );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print "The LVM disk image already exists. Aborting.\n";
|
||||||
|
print "Specify '--force' to delete and recreate\n";
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# Check whether the sawp volume exists already, and if so abort
|
||||||
|
# unless '--force' is specified.
|
||||||
|
#
|
||||||
|
my $lvm_swap = "/dev/$CONFIG{'lvm'}/$CONFIG{'hostname'}-swap";
|
||||||
|
if ( -e $lvm_swap )
|
||||||
|
{
|
||||||
|
# Delete if forcing
|
||||||
|
if ( $CONFIG{'force'} )
|
||||||
|
{
|
||||||
|
runCommand( "lvremove --force $lvm_swap" );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print "The LVM sawp image already exists. Aborting.\n";
|
||||||
|
print "Specify '--force' to delete and recreate\n";
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Modify the sizes to something reasonable
|
# Modify the sizes to something reasonable
|
||||||
|
|||||||
Reference in New Issue
Block a user