From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ian Jackson Subject: [OSSTEST PATCH 23/26] Timeouts: Introduce target_adjust_timeout Date: Fri, 18 Sep 2015 18:50:13 +0100 Message-ID: <1442598616-2884-10-git-send-email-ian.jackson@eu.citrix.com> References: <1442598616-2884-1-git-send-email-ian.jackson@eu.citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1Zcznt-0004GZ-Dw for xen-devel@lists.xenproject.org; Fri, 18 Sep 2015 17:50:33 +0000 In-Reply-To: <1442598616-2884-1-git-send-email-ian.jackson@eu.citrix.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: xen-devel@lists.xenproject.org Cc: Ian Jackson , Ian Campbell List-Id: xen-devel@lists.xenproject.org This function is now called for almost every timeout. Specifically, it is called in the cases in TestSupport where a guest- or host-related timeout is passed from code which has a $ho or $gho, to code which does not: all callers of poll_loop, and tcmd. Currently the function is a no-op. Its existence and use will allow us to introduce various provocations for adjusting timeouts, of which I have one planned. Signed-off-by: Ian Jackson --- Osstest/TestSupport.pm | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm index 0afaeab..f1f900e 100644 --- a/Osstest/TestSupport.pm +++ b/Osstest/TestSupport.pm @@ -310,6 +310,10 @@ END return $value; } +sub target_adjust_timeout ($$) { + my ($ho,$timeoutref) = @_; # $ho might be a $gho +} + #---------- running commands eg on targets ---------- sub cmd { @@ -608,6 +612,7 @@ sub target_ping_check_up ($) { return target_ping_check_core(@_,0); } sub target_await_down ($$) { my ($ho,$timeout) = @_; + target_adjust_timeout($ho,\$timeout); poll_loop($timeout,5,'reboot-down', sub { return target_ping_check_down($ho); }); @@ -616,6 +621,7 @@ sub target_await_down ($$) { sub tcmd { # $tcmd will be put between '' but not escaped my ($stdout,$user,$ho,$tcmd,$timeout,$extrasshopts) = @_; $timeout=30 if !defined $timeout; + target_adjust_timeout($ho,\$timeout); tcmdex($timeout,$stdout, 'ssh', sshopts(), @{ $extrasshopts || [] }, sshuho($user,$ho), $tcmd); @@ -1018,7 +1024,9 @@ sub common_toolstack ($) { sub host_reboot ($) { my ($ho) = @_; target_reboot($ho); - poll_loop(40,2, 'reboot-confirm-booted', sub { + my $timeout = 40; + target_adjust_timeout($ho,\$timeout); + poll_loop($timeout,2, 'reboot-confirm-booted', sub { my $output; if (!eval { $output= target_cmd_output($ho, <{Guest}", sub { my $st= guest_get_state($ho,$gho); return undef if $st eq $wait_st; @@ -1850,6 +1859,7 @@ sub guest_checkrunning ($$) { sub guest_await_dhcp_tcp ($$) { my ($gho,$timeout) = @_; guest_find_tcpcheckport($gho); + target_adjust_timeout($gho,\$timeout); poll_loop($timeout,1, "guest $gho->{Name} ".visible_undef($gho->{Ether}). " $gho->{TcpCheckPort}". @@ -1925,6 +1935,7 @@ sub target_tcp_check ($$) { sub await_tcp ($$$) { my ($maxwait,$interval,$ho) = @_; + target_adjust_timeout($ho,\$maxwait); poll_loop($maxwait,$interval, "await tcp $ho->{Name} $ho->{TcpCheckPort}", sub { @@ -2106,6 +2117,7 @@ sub await_webspace_fetch_byleaf ($$$$$) { my ($maxwait,$interval,$logtailer, $ho, $url) = @_; my $leaf= $url; $leaf =~ s,.*/,,; + target_adjust_timeout($ho,\$maxwait); poll_loop($maxwait,$interval, "fetch $leaf", sub { my ($line, $last); $last= '(none)'; -- 1.7.10.4