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

[Xen-devel] [OSSTEST PATCH 17/21] starvation: Use "starved" for hostalloc_maxwait_max



Previously this was "broken".

We mustn't just call `broken' inside attempt_allocation because that
runs in a db transaction.  Instead, we arrange that attempt_allocation
returns 2, which threads its way back out to the return value from
alloc_resources, and then call broken there.

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

diff --git a/ts-hosts-allocate-Executive b/ts-hosts-allocate-Executive
index 3425c8ce..8c9ddaf7 100755
--- a/ts-hosts-allocate-Executive
+++ b/ts-hosts-allocate-Executive
@@ -683,12 +683,17 @@ sub alloc_hosts () {
         ? -10000
         : -10 * @hids;
 
-    alloc_resources(WaitStart =>
+    my $ok = alloc_resources(WaitStart =>
                     ($ENV{OSSTEST_RESOURCE_WAITSTART} || $fi->{started}),
                     WaitStartAdjust => $waitstartadjust,
                    DebugFh => \*DEBUG,
                     \&attempt_allocation);
 
+    if ($ok==2) {
+       broken "starved or timed out", 'starved';
+    }
+    die $ok unless $ok==1;
+
     foreach my $hid (@hids) {
         my $sel= $hid->{Selected};
         die $hid->{Ident} unless defined $sel->{resname};
@@ -764,9 +769,11 @@ sub attempt_allocation {
            #  * we have been waiting at least $maxwait/2
            #  * we estimate it will take at least $maxwait overall
            my $wait_sofar = $now - $alloc_start_time;
-           die "timed out: $wait_sofar, $best->{Start}, $maxwait"
-                if $wait_sofar > $maxwait/2
-               && $wait_sofar + $best->{Start} > $maxwait;
+           if ($wait_sofar > $maxwait/2
+               && $wait_sofar + $best->{Start} > $maxwait) {
+               logm "timed out: $wait_sofar, $best->{Start}, $maxwait";
+               return 2;
+           }
        }
     }
 
-- 
2.11.0


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

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