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

[Xen-devel] [OSSTEST PATCH 16/24] ts-hosts-allocate-Executive: Honour hostalloc_maxwait_max



No functional change with existing flights.

Signed-off-by: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
---
 ts-hosts-allocate-Executive | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/ts-hosts-allocate-Executive b/ts-hosts-allocate-Executive
index 0987e2b..9955cba 100755
--- a/ts-hosts-allocate-Executive
+++ b/ts-hosts-allocate-Executive
@@ -56,6 +56,7 @@ if ($ENV{'OSSTEST_NOALLOCATE'}) {
 }
 
 # initialised by setup:
+our $alloc_start_time;
 our $taskid;
 our %magictaskid;
 our $fi;
@@ -109,6 +110,8 @@ END
              WHERE type='magic' AND refkey=?
 END
     }
+
+    $alloc_start_time = time // die $!;
 }
 
 #---------- prepared sql statements ----------
@@ -748,6 +751,16 @@ sub attempt_allocation {
        logm("host allocation: successful, reporting to planner.");
     } else {
        logm("host allocation: planned start in $best->{Start} seconds.");
+       my $maxwait = $r{hostalloc_maxwait_max};
+       if (defined $maxwait) {
+           # We quit if:
+           #  * we have been waiting at least $maxwait/2
+           #  * we estimate it will take at least $maxwait overall
+           my $wait_sofar = (time // die $!) - $alloc_start_time;
+           die "timed out: $wait_sofar, $best->{Start}, $maxwait"
+                if $wait_sofar > $maxwait/2
+               && $wait_sofar + $best->{Start} > $maxwait;
+       }
     }
 
     if ($fake) {
-- 
2.1.4


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

 


Rackspace

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