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

[Xen-devel] [OSSTEST PATCH] ts-hosts-allocate-Executive: Do not allocate specific host with wrong blessing



If the job contains a runvar specifying a specific host, still check
that host's blessing.  Otherwise bisections can run on unblessed
hosts.  They should fail instead.

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

diff --git a/ts-hosts-allocate-Executive b/ts-hosts-allocate-Executive
index dd9fcf2..88da504 100755
--- a/ts-hosts-allocate-Executive
+++ b/ts-hosts-allocate-Executive
@@ -279,26 +279,26 @@ sub hid_find_possibilities ($) {
 
     my $use= $hid->{OverrideUse} || $r{ $hid->{Ident} };
 
-    my $findhostsq;
-    if (defined $use) {
-        print DEBUG "HID $hid->{Ident} USE $use\n";
-       $findhostsq= $dbh_tests->prepare(<<END);
-           SELECT *
-             FROM resources
-            WHERE restype=? AND resname=? AND shareix=0
-END
-        $findhostsq->execute('host',$use);
-    } else {
-        print DEBUG "HID $hid->{Ident} INTENDED $fi->{intended}\n";
-       $findhostsq= $dbh_tests->prepare(<<END);
+    print DEBUG "HID $hid->{Ident} INTENDED $fi->{intended}\n";
+    my $findhostsq = <<END;
            SELECT *
              FROM resources JOIN hostflags
                ON (restype='host' AND shareix=0 AND
                    resname=hostname AND hostflag=?)
 END
-        $findhostsq->execute("blessed-$fi->{intended}");
+    my @findhostsqvars = ("blessed-$fi->{intended}");
+
+    if (defined $use) {
+        print DEBUG "HID $hid->{Ident} USE $use\n";
+       $findhostsq .= <<END;
+            WHERE restype='host' AND resname=? AND shareix=0
+END
+        push @findhostsqvars, $use;
     }
 
+    $findhostsq= $dbh_tests->prepare($findhostsq);
+    $findhostsq->execute(@findhostsqvars);
+
     my $equivstatusq= $dbh_tests->prepare(<<END);
             SELECT flight, job, val, status
              FROM flights f
@@ -423,7 +423,7 @@ END
 
     if (!@candidates) {
         if (defined $use) {
-            logm("specified host $use for $hid->{Ident} nonexistent?");
+ logm("specified host $use for $hid->{Ident} nonexistent or unblessed?");
         } else {
             logm("no suitable host for $hid->{Ident} (out of $any)");
         }
-- 
1.7.10.4


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


 


Rackspace

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