1
0
mirror of synced 2026-01-13 15:17:30 +00:00

Move findXenToolstack() to Xen::Tools::Common

This commit is contained in:
Axel Beckert 2012-11-27 22:48:37 +01:00
parent 494ec02a7c
commit 76fbd23423
2 changed files with 35 additions and 35 deletions

View File

@ -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.

View File

@ -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