]> xenbits.xensource.com Git - osstest.git/commitdiff
ts-hosts-allocate-Executive: Do a pre-check
authorIan Jackson <ian.jackson@eu.citrix.com>
Wed, 19 Aug 2020 11:52:04 +0000 (12:52 +0100)
committerIan Jackson <ian.jackson@eu.citrix.com>
Thu, 20 Aug 2020 13:23:55 +0000 (14:23 +0100)
Call attempt_allocation with an empty plan and $mayalloc=0.

In the usual case this will arrange to prime our memoisation caches
before we get involved with the queueing system.

It will also arrange for various errors to be reported sooner.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
v2: Improved error and result handling

ts-hosts-allocate-Executive

index 31621cfbb2c4d4620d1c13033522ca96dd19443f..698437c051209ec939518965d4f9fc154394e4e0 100755 (executable)
@@ -698,6 +698,15 @@ sub alloc_hosts () {
         return;
     }
 
+    {
+       logm("pre-checking resources...");
+       local $Osstest::TestSupport::logm_prefix = $logm_prefix.' (precheck)';
+       my ($ok, $bookinglist) = attempt_allocation({
+            ts_hosts_allocate_precheck => 1,
+        }, 0);
+       die $ok if $ok>1;
+    }
+
     my $waitstartadjust=
         $jobinfo->{recipe} =~ m/build/
         ? -10000
@@ -851,6 +860,7 @@ sub attempt_allocation {
        logm("no plan is possible - no suitable hosts");
        return $alloc_starved_r;
     }
+    return 0 if $plan->{ts_hosts_allocate_precheck};
 
     foreach (my $ix=0; $ix<@hids; $ix++) {
        $hids[$ix]{Selected}= $best->{Selections}[$ix];