@@ -905,6 +905,13 @@ sub compress_stashed($) {
#---------- other stuff ----------
+sub common_toolstack () {
+ my $tsname= $r{toolstack} || 'xend';
+ my $ts = 'xl';
+ $ts = 'xm' if $tsname eq 'xend';
+ return $ts;
+}
+
sub host_reboot ($) {
my ($ho) = @_;
target_reboot($ho);
@@ -924,7 +931,7 @@ sub host_reboot ($) {
sub host_get_free_memory($) {
my ($ho) = @_;
- my $toolstack = toolstack($ho)->{Command};
+ my $toolstack = common_toolstack();
# The line is as followed:
# free_memory : XXXX
my $info = target_cmd_output_root($ho, "$toolstack info", 10);
@@ -1558,7 +1565,7 @@ sub guest_check_up ($) {
sub guest_get_state ($$) {
my ($ho,$gho) = @_;
- my $domains= target_cmd_output_root($ho, toolstack($ho)->{Command}." list");
+ my $domains= target_cmd_output_root($ho, common_toolstack()." list");
$domains =~ s/^Name.*\n//;
foreach my $l (split /\n/, $domains) {
$l =~ m/^(\S+) (?: \s+ \d+ ){3} \s+ ([-a-z]+) \s/x or die "$l ?";
@@ -1763,7 +1770,7 @@ sub guest_find_domid ($$) {
my ($ho,$gho) = @_;
return if defined $gho->{Domid};
my $list= target_cmd_output_root($ho,
- toolstack($ho)->{Command}." list $gho->{Name}");
+ common_toolstack()." list $gho->{Name}");
$list =~ m/^(?!Name\s)(\S+)\s+(\d+)\s+(\d+)+(\d+)\s.*$/m
or die "domain list: $list";
$1 eq $gho->{Name} or die "domain list name $1 expected $gho->{Name}";
Unless the toolstack is xend (for compatibility with pre-xl Xen versions), when we use xm. For several operations in TestSupport.pm the actual toolstack isn't really relevant, since we want info straight from Xen. For simplicity just use xl (or xm) in these cases, to avoid needing to implement the following specially for each toolstack: - host_get_free_memory - guest_get_state - guest_find_domid Signed-off-by: Ian Campbell <ian.campbell@citrix.com> --- Osstest/TestSupport.pm | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)