1
0
mirror of synced 2026-02-13 19:04:07 +00:00

2007-04-28 15:34:19 by steve

Refuse to delete running Xen guests.
  #419561
This commit is contained in:
steve
2007-04-28 15:34:19 +00:00
parent 05090f4b53
commit f36c7d7547
2 changed files with 45 additions and 3 deletions

View File

@@ -136,7 +136,7 @@ Show the version number and exit.
--
http://www.steve.org.uk/
$Id: xen-delete-image,v 1.32 2007-04-03 00:20:43 steve Exp $
$Id: xen-delete-image,v 1.33 2007-04-28 15:34:19 steve Exp $
=cut
@@ -221,7 +221,14 @@ E_O_ROOT
#
while( my $name = shift )
{
deleteXenImage( $name );
if ( !xenRunning( $name ) )
{
#deleteXenImage( $name );
}
else
{
print "Skipping xen guest '$name' - it appears to be running.\n";
}
}
#
@@ -335,7 +342,7 @@ sub parseCommandLineArguments
if ( $VERSION )
{
my $REVISION = '$Revision: 1.32 $';
my $REVISION = '$Revision: 1.33 $';
if ( $REVISION =~ /1.([0-9.]+) / )
{
@@ -394,6 +401,34 @@ sub checkArguments
=begin doc
Test to see if the given instance is running.
=end doc
=cut
sub xenRunning
{
my( $hostname ) = (@_ );
my $running = 0;
open( CMD, "xm list 2>/dev/null |")
or die "Failed to run 'xm list $hostname'";
while( <CMD> )
{
my $line = $_;
$running = 1 if ( $line =~ /\Q$hostname\E/ )
}
close( CMD );
return( $running );
}
=begin doc
Delete the named image, and the corresponding configuration file

7
debian/changelog vendored
View File

@@ -1,3 +1,10 @@
xen-tools (3.3-1) unstable; urgency=low
[ Steve Kemp ]
* New upstream release v3.3
- Refuse to delete running guests. (Closes: #419561)
xen-tools (3.2-1) unstable; urgency=low
[ Steve Kemp ]