deduplicate xenRunning()
This commit is contained in:
parent
1d45cd33ab
commit
2de01d8cbc
@ -350,33 +350,6 @@ 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 $hostname 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
|
||||
|
||||
@ -446,31 +446,3 @@ EOF
|
||||
$CONFIG{ 'add' } = $1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
=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 $hostname 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);
|
||||
}
|
||||
|
||||
@ -332,34 +332,6 @@ sub updateXenImage
|
||||
|
||||
|
||||
|
||||
=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
|
||||
|
||||
Parse the arguments specified upon the command line.
|
||||
|
||||
@ -18,7 +18,7 @@ use strict;
|
||||
use Exporter 'import';
|
||||
use vars qw(@EXPORT_OK @EXPORT);
|
||||
|
||||
@EXPORT = qw(readConfigurationFile);
|
||||
@EXPORT = qw(readConfigurationFile xenRunning);
|
||||
|
||||
=head1 FUNCTIONS
|
||||
|
||||
@ -103,6 +103,34 @@ sub readConfigurationFile ($$)
|
||||
close(FILE);
|
||||
}
|
||||
|
||||
=head2 xenRunning
|
||||
|
||||
=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 $hostname 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);
|
||||
}
|
||||
|
||||
=head1 AUTHORS
|
||||
|
||||
Steve Kemp, http://www.steve.org.uk/
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user