From: Ian Jackson Subject: [OSSTEST PATCH 1/3] Executive: support DebugFh xparam to alloc_resources Date: Fri, 21 Feb 2014 13:37:29 +0000 Message-ID: <1392989851-26051-2-git-send-email-ian.jackson@eu.citrix.com> References: <1392989851-26051-1-git-send-email-ian.jackson@eu.citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WGqIU-00070b-CM for xen-devel@lists.xenproject.org; Fri, 21 Feb 2014 13:37:46 +0000 In-Reply-To: <1392989851-26051-1-git-send-email-ian.jackson@eu.citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xenproject.org Cc: Ian Jackson , Ian Campbell List-Id: xen-devel@lists.xenproject.org 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 --- 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