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

[Xen-devel] [OSSTEST PATCH 23/26] Timeouts: Introduce target_adjust_timeout



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 <Ian.Jackson@xxxxxxxxxxxxx>
---
 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, <<END, 40);
@@ -1397,6 +1405,7 @@ sub report_once ($$$) {
 sub guest_await_state ($$$$$) {
     my ($ho,$gho, $what,$wait_st,$timeout) = @_;
 
+    target_adjust_timeout($gho,\$timeout);
     poll_loop($timeout, 30, "await $what request from $gho->{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


_______________________________________________
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®.