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

[Xen-devel] [OSSTEST PATCH 1/3] Executive: support DebugFh xparam to alloc_resources



This redirects some of the more verbose output (the json dumps)
elsewhere.  If DebugFh is not set, this output is suppressed.

ts-hosts-allocate-Executive provides DebugFh pointing to its DEBUG fh.

Signed-off-by: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
---
 Osstest/Executive.pm        |   11 +++++++++--
 ts-hosts-allocate-Executive |    1 +
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/Osstest/Executive.pm b/Osstest/Executive.pm
index ac7b734..33f12e4 100644
--- a/Osstest/Executive.pm
+++ b/Osstest/Executive.pm
@@ -362,6 +362,11 @@ sub alloc_resources {
 
     logm("resource allocation: starting...");
 
+    my $debugfh = $xparams{DebugFh};
+    my $debugm = $debugfh
+       ? sub { print $debugfh @_, "\n" or die $!; }
+        : sub { };
+
     my $set_info= sub {
         return if grep { !defined } @_;
         my @s;
@@ -449,7 +454,8 @@ sub alloc_resources {
                read($qserv, $jplan, $jplanlen) == $jplanlen or die $!;
                my $jplanprint= $jplan;
                chomp $jplanprint;
-               logm("resource allocation: base plan $jplanprint");
+               logm("resource allocation: obtained base plan.");
+               $debugm->("base plan = ", $jplanprint);
                $plan= from_json($jplan);
            }, sub {
                if (!eval {
@@ -465,7 +471,8 @@ sub alloc_resources {
            if ($bookinglist && $ok!=-1) {
                my $jbookings= to_json($bookinglist);
                 chomp($jbookings);
-                logm("resource allocation: booking $jbookings");
+                logm("resource allocation: booking.");
+               $debugm->("bookings = ", $jbookings);
 
                printf $qserv "book-resources %d\n", length $jbookings
                    or die $!;
diff --git a/ts-hosts-allocate-Executive b/ts-hosts-allocate-Executive
index 05046e3..0f967e2 100755
--- a/ts-hosts-allocate-Executive
+++ b/ts-hosts-allocate-Executive
@@ -526,6 +526,7 @@ sub alloc_hosts () {
     alloc_resources(WaitStart =>
                     ($ENV{OSSTEST_RESOURCE_WAITSTART} || $fi->{started}),
                     WaitStartAdjust => $waitstartadjust,
+                   DebugFh => \*DEBUG,
                     \&attempt_allocation);
 
     foreach my $hid (@hids) {
-- 
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®.