]> xenbits.xensource.com Git - people/liuw/osstest.git/commitdiff
sg-report-host-history: Support flight:FLIGHT
authorIan Jackson <ian.jackson@eu.citrix.com>
Wed, 17 Jun 2015 16:05:58 +0000 (17:05 +0100)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Thu, 18 Jun 2015 15:31:04 +0000 (16:31 +0100)
Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
sg-report-host-history

index 8a4d40f1ba65e8bf073e8a29d2a61453ef89be96..b3ef63e0fe184cc2ad89f599c9dd40d9469518cc 100755 (executable)
@@ -162,6 +162,8 @@ END
         LIMIT 1
 END
 
+    print DEBUG "QUERYING RUNVARS FOR $hostname\n";
+
     my @rows;
     $runvarq->execute($hostname);
 
@@ -252,7 +254,25 @@ $dbh_tests->do("SET LOCAL enable_seqscan=false");
 our %hosts;
 
 foreach my $host (@ARGV) {
-    $hosts{$host}++;
+    if ($host =~ m/^flight:/) {
+       my $flight=$'; #';
+       db_retry($dbh_tests, [qw(flights)], sub {
+           our $hostsinflightq //= db_prepare(<<END);
+               SELECT DISTINCT val
+                 FROM runvars
+                WHERE flight=?
+                  AND (name = 'host' or name like '%_host')
+END
+            $hostsinflightq->execute($flight);
+           while (my $row = $hostsinflightq->fetchrow_hashref()) {
+               $hosts{$row->{val}}++;
+           }
+       });
+    } elsif ($host !~ m/:/) {
+       $hosts{$host}++;
+    } else {
+       die "$host ?";
+    }
 }
 
 foreach my $host (sort keys %hosts) {