Move findXenToolstack() to Xen::Tools::Common
This commit is contained in:
parent
494ec02a7c
commit
76fbd23423
@ -1394,40 +1394,6 @@ sub setupDefaultOptions
|
||||
|
||||
|
||||
|
||||
=begin doc
|
||||
|
||||
Find the right Xen toolstack. On Debian and derivatives there's a
|
||||
script which tells you about the current toolstack.
|
||||
|
||||
=end doc
|
||||
|
||||
=cut
|
||||
|
||||
sub findXenToolstack
|
||||
{
|
||||
my $helper = '/usr/lib/xen-common/bin/xen-toolstack';
|
||||
|
||||
if (-x $helper) {
|
||||
my $toolstack = `$helper`;
|
||||
chomp($toolstack);
|
||||
return $toolstack if $toolstack;
|
||||
}
|
||||
|
||||
my $xm = findBinary('xm');
|
||||
if ($xm and system("$xm list >/dev/null 2>/dev/null") == 0) {
|
||||
return $xm;
|
||||
}
|
||||
|
||||
my $xl = findBinary('xl');
|
||||
if ($xl and system("$xl list >/dev/null 2>/dev/null") == 0) {
|
||||
return $xl;
|
||||
}
|
||||
|
||||
return undef;
|
||||
}
|
||||
|
||||
|
||||
|
||||
=begin doc
|
||||
|
||||
Validate options and do what is necessary with them.
|
||||
|
||||
@ -21,7 +21,7 @@ use vars qw(@EXPORT_OK @EXPORT);
|
||||
use English;
|
||||
|
||||
@EXPORT = qw(readConfigurationFile xenRunning runCommand setupAdminUsers
|
||||
logprint logonly fail);
|
||||
findXenToolstack logprint logonly fail);
|
||||
|
||||
=head1 FUNCTIONS
|
||||
|
||||
@ -134,6 +134,40 @@ sub xenRunning ($)
|
||||
return ($running);
|
||||
}
|
||||
|
||||
=head2 findXenToolstack
|
||||
|
||||
=begin doc
|
||||
|
||||
Find the right Xen toolstack. On Debian and derivatives there's a
|
||||
script which tells you about the current toolstack.
|
||||
|
||||
=end doc
|
||||
|
||||
=cut
|
||||
|
||||
sub findXenToolstack
|
||||
{
|
||||
my $helper = '/usr/lib/xen-common/bin/xen-toolstack';
|
||||
|
||||
if (-x $helper) {
|
||||
my $toolstack = `$helper`;
|
||||
chomp($toolstack);
|
||||
return $toolstack if $toolstack;
|
||||
}
|
||||
|
||||
my $xm = findBinary('xm');
|
||||
if ($xm and system("$xm list >/dev/null 2>/dev/null") == 0) {
|
||||
return $xm;
|
||||
}
|
||||
|
||||
my $xl = findBinary('xl');
|
||||
if ($xl and system("$xl list >/dev/null 2>/dev/null") == 0) {
|
||||
return $xl;
|
||||
}
|
||||
|
||||
return undef;
|
||||
}
|
||||
|
||||
=head2 runCommand
|
||||
|
||||
=begin doc
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user