2006-11-28 17:43:49 by steve
1. Allow "--hostname=a --hostname=b --hostname=c" or just " a b c"
to delete three machines. (Or any mixture!)
2. Order option help alphabetically.
This commit is contained in:
@@ -6,7 +6,7 @@ xen-delete-image - Delete previously created Xen instances.
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
xen-delete-image [options] imageName1 imageName2 ... imageNameN
|
||||
xen-delete-image [options] [--hostname=]imageName1 [--hostname=]imageName2
|
||||
|
||||
Help Options:
|
||||
--help Show help information.
|
||||
@@ -19,6 +19,9 @@ xen-delete-image - Delete previously created Xen instances.
|
||||
--lvm Specify the LVM volume to use.
|
||||
--evms Specify the EVMS container to use.
|
||||
|
||||
Specifying hosts:
|
||||
--hostname Specify the image name to delete.
|
||||
|
||||
Testing options:
|
||||
--test Don't complain if we're not invoked by root.
|
||||
|
||||
@@ -32,9 +35,18 @@ xen-delete-image - Delete previously created Xen instances.
|
||||
=item B<--dir>
|
||||
Specify the output directory where images were previously saved.
|
||||
|
||||
=item B<--evms>
|
||||
Specify the EVMS container where images were previously saved.
|
||||
|
||||
=item B<--help>
|
||||
Show help information.
|
||||
|
||||
=item B<--hostname>
|
||||
Specify the hostname to delete.
|
||||
|
||||
=item B<--lvm>
|
||||
Specify the LVM volume group where images were previously saved.
|
||||
|
||||
=item B<--manual>
|
||||
Read the manual for this script.
|
||||
|
||||
@@ -44,11 +56,6 @@ Don not complain, or exit, if the script is not executed by the root user.
|
||||
=item B<--version>
|
||||
Show the version number and exit.
|
||||
|
||||
=item B<--lvm>
|
||||
Specify the LVM volume group where images were previously saved.
|
||||
|
||||
=item B<--evms>
|
||||
Specify the EVMS container where images were previously saved.
|
||||
|
||||
=back
|
||||
|
||||
@@ -105,7 +112,7 @@ Specify the EVMS container where images were previously saved.
|
||||
Assuming that you have the container 'mycontainer' containing three
|
||||
Xen instances 'foo', 'bar', and 'baz' the first two may be deleted via:
|
||||
|
||||
xen-delete-image --evms=lvm2/mycontainer foo bar
|
||||
xen-delete-image --evms=lvm2/mycontainer --hostname=foo --hostname=bar
|
||||
|
||||
This will remove the volumes 'foo-disk', 'foo-swap', 'bar-disk',
|
||||
and 'bar-swap'.
|
||||
@@ -124,7 +131,7 @@ Specify the EVMS container where images were previously saved.
|
||||
--
|
||||
http://www.steve.org.uk/
|
||||
|
||||
$Id: xen-delete-image,v 1.23 2006-11-19 19:41:34 steve Exp $
|
||||
$Id: xen-delete-image,v 1.24 2006-11-28 17:43:49 steve Exp $
|
||||
|
||||
=cut
|
||||
|
||||
@@ -212,6 +219,14 @@ while( my $name = shift )
|
||||
deleteXenImage( $name );
|
||||
}
|
||||
|
||||
#
|
||||
# Also delete any which were specified using the --hostname flag
|
||||
#
|
||||
my $hosts = $CONFIG{'hostname'};
|
||||
foreach my $name ( @$hosts )
|
||||
{
|
||||
deleteXenImage( $name );
|
||||
}
|
||||
|
||||
#
|
||||
# All done.
|
||||
@@ -298,14 +313,15 @@ sub parseCommandLineArguments
|
||||
# Parse options.
|
||||
#
|
||||
GetOptions(
|
||||
"dir=s", \$CONFIG{'dir'},
|
||||
"lvm=s", \$CONFIG{'lvm'},
|
||||
"dir=s", \$CONFIG{'dir'},
|
||||
"lvm=s", \$CONFIG{'lvm'},
|
||||
"evms=s", \$CONFIG{'evms'},
|
||||
"test", \$CONFIG{'test'},
|
||||
"verbose", \$CONFIG{'verbose'},
|
||||
"help", \$HELP,
|
||||
"manual", \$MANUAL,
|
||||
"version", \$VERSION
|
||||
"hostname=s@", \$CONFIG{'hostname'},
|
||||
"test", \$CONFIG{'test'},
|
||||
"verbose", \$CONFIG{'verbose'},
|
||||
"help", \$HELP,
|
||||
"manual", \$MANUAL,
|
||||
"version", \$VERSION
|
||||
);
|
||||
|
||||
pod2usage(1) if $HELP;
|
||||
@@ -314,7 +330,7 @@ sub parseCommandLineArguments
|
||||
|
||||
if ( $VERSION )
|
||||
{
|
||||
my $REVISION = '$Revision: 1.23 $';
|
||||
my $REVISION = '$Revision: 1.24 $';
|
||||
|
||||
if ( $REVISION =~ /1.([0-9.]+) / )
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user