From: Ian Campbell Subject: [PATCH RFC OSSTEST 4/9] TestSupport: always use xl for generic operations. Date: Tue, 17 Jun 2014 16:26:44 +0100 Message-ID: <1403018809-25509-4-git-send-email-ian.campbell@citrix.com> References: <1403018758.25074.5.camel@kazak.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1403018758.25074.5.camel@kazak.uk.xensource.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: ian.jackson@eu.citrix.com Cc: Ian Campbell , xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org 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 --- Osstest/TestSupport.pm | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm index 6129e9e..11a036f 100644 --- a/Osstest/TestSupport.pm +++ b/Osstest/TestSupport.pm @@ -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}"; -- 1.9.0