]> xenbits.xensource.com Git - people/aperard/osstest.git/commitdiff
host allocation: Prepare for further starvation check
authorIan Jackson <iwj@xenproject.org>
Mon, 7 Jun 2021 14:12:58 +0000 (15:12 +0100)
committerIan Jackson <iwj@xenproject.org>
Mon, 7 Jun 2021 15:14:47 +0000 (16:14 +0100)
* Add a new job pattern parameter to $starvation_q
* Add a new $thisclass parameter to starving
* Pass 0 for now.

Signed-off-by: Ian Jackson <iwj@xenproject.org>
ts-hosts-allocate-Executive

index 459b9215a448a38c3e8a6ebc93206bbb2979a476..9722ce127ad6fa7960529c01acee87f4da8761ea 100755 (executable)
@@ -162,6 +162,7 @@ END
      LEFT JOIN steps
          USING (flight,job)
          WHERE flight= ?
+           AND job LIKE ?
       GROUP BY job, jobs.status
 END
 
@@ -822,11 +823,12 @@ sub most_optimistic ($$$) {
     return $optimist->{Got};
 }
 
-sub starving ($$) {
-    my ($best_start_abs, $now) = @_;
+sub starving ($$$) {
+    my ($best_start_abs, $now, $thisclass) = @_;
     return (0, 'runvar says never give up') unless %$starvation_p;
     return (0, 'no estimate') unless defined $best_start_abs;
-    $starvation_q->execute($flight);
+    my $joblike = $thisclass ? ($job =~ s/(?:(-)|\W).*/$1\%/r) : '%';
+    $starvation_q->execute($flight, $joblike);
     my $d=0;
     my $w=0;
     my $maxfin=0;
@@ -935,7 +937,7 @@ sub attempt_allocation {
            }
        } elsif (%$starvation_p) {
            my $est_abs = most_optimistic($best, $now, $starvation_p->{I});
-           my ($starving, $m) = starving($est_abs, $now);
+           my ($starving, $m) = starving($est_abs, $now, 0);
            $starvation_q->finish();
            if (!$starving) {
                print DEBUG "not starving: $m\n";