[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH OSSTEST v2 06/18] TestSupport: always use xl for generic operations.



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
  - listing assignable pci devices

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
---
 Osstest/TestSupport.pm | 13 ++++++++++---
 ts-debian-fixup        |  2 +-
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm
index df05d8a..3f63273 100644
--- a/Osstest/TestSupport.pm
+++ b/Osstest/TestSupport.pm
@@ -936,6 +936,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);
@@ -956,7 +963,7 @@ END
 
 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);
@@ -1610,7 +1617,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 ?";
@@ -1815,7 +1822,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}";
diff --git a/ts-debian-fixup b/ts-debian-fixup
index 11e956c..0dc2d07 100755
--- a/ts-debian-fixup
+++ b/ts-debian-fixup
@@ -142,7 +142,7 @@ sub otherfixupcfg () {
     if (@pcipt) {
         logm("checking passthrough device(s) are assignable: @pcipt");
         my @assignables= split /\n/,
-            target_cmd_output_root($ho, toolstack($ho)->{Command}.
+            target_cmd_output_root($ho, common_toolstack().
                                    " pci-assignable-list");
         foreach my $pcipt (@pcipt) {
             die "not assignable: $pcipt (not in: @assignables)"
-- 
2.1.1


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.