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

[Xen-devel] [OSSTEST PATCH 1/4] host allocation: Support -B<blessing> option



The flight's intended affects the hostflags required, the duration
searches, and other decisions.  It is particularly useful for
debugging, where it can be desirable to try replaying a production
job's allocation with a "play" job.

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

diff --git a/ts-hosts-allocate-Executive b/ts-hosts-allocate-Executive
index 706ab6d..7c32847 100755
--- a/ts-hosts-allocate-Executive
+++ b/ts-hosts-allocate-Executive
@@ -31,12 +31,15 @@ open DEBUG, ">/dev/null" or die $!;
 
 our $compressdebug=1;
 our $fake; # never allocate
+our $blessing;
 
 while (@ARGV and $ARGV[0] =~ m/^-/) {
     $_= shift @ARGV;
     last if m/^--$/;
     while (m/^-./) {
-        if (s/^-U/-/) {
+        if (s/^-B(.*)/-/) {
+           $blessing=$1; # default is flight's intended blessing
+       } elsif (s/^-U/-/) {
            $compressdebug=0;
        } elsif (s/^-n/-/) {
            $fake=1;
@@ -84,7 +87,9 @@ sub setup () {
         SELECT * FROM flights
          WHERE flight = ?
 END
-    logm("flight $flight intended $fi->{intended} branch $fi->{branch}");
+
+    $blessing //= $fi->{intended};
+    logm("flight $flight intended $blessing branch $fi->{branch}");
 
     $jobinfo= $dbh_tests->selectrow_hashref(<<END, {}, $flight, $job);
         SELECT * FROM jobs
@@ -121,7 +126,7 @@ END
                      AND hostflag LIKE 'equiv-%'
 END
 
-    $duration_estimator= duration_estimator($fi->{branch}, $fi->{intended},
+    $duration_estimator= duration_estimator($fi->{branch}, $blessing,
                                             sub { print DEBUG "@_\n"; });
 
     $resprop_q= $dbh_tests->prepare(<<END);
@@ -284,14 +289,14 @@ sub hid_find_possibilities ($$) {
 
     my $use= $hid->{OverrideUse} || $r{ $hid->{Ident} };
 
-    print DEBUG "HID $hid->{Ident} INTENDED $fi->{intended}\n";
+    print DEBUG "HID $hid->{Ident} INTENDED $blessing\n";
     my $findhostsq = <<END;
            SELECT *
              FROM resources JOIN hostflags
                ON (restype='host' AND shareix=0 AND
                    resname=hostname AND hostflag=?)
 END
-    my @findhostsqvars = ("blessed-$fi->{intended}");
+    my @findhostsqvars = ("blessed-$blessing");
 
     if (defined $use) {
         print DEBUG "HID $hid->{Ident} USE $use\n";
@@ -431,7 +436,7 @@ END
         find_recent_duration($dbg,$hid,$candrow);
 
        if ($candrow->{restype} eq 'host') {
-           $equivstatusq->execute($job,$fi->{intended},$fi->{branch},
+           $equivstatusq->execute($job,$blessing,$fi->{branch},
                                   $hid->{Ident},$candrow->{resname});
            my $esrow = $equivstatusq->fetchrow_hashref();
            $candrow->{EquivMostRecentStatus} = $esrow->{status};
-- 
1.7.10.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®.