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

[Xen-devel] [OSSTEST PATCH 3/3] ts-hosts-allocate-Executive: Compress debug output



Send the voluminous host allocation debug output to a compressed
logfile "hosts-allocate.debug.gz".  Also send a copy of the logm
output to the debug log, by manipulating $logm_handle.

Remove the bodge which unshifted -D onto the arguments, and then
parsed it.  Now the script takes no options.

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

diff --git a/ts-hosts-allocate-Executive b/ts-hosts-allocate-Executive
index 0f967e2..707c6a7 100755
--- a/ts-hosts-allocate-Executive
+++ b/ts-hosts-allocate-Executive
@@ -29,15 +29,12 @@ tsreadconfig();
 
 open DEBUG, ">/dev/null" or die $!;
 
-unshift @ARGV, '-D';
-
 while (@ARGV and $ARGV[0] =~ m/^-/) {
     $_= shift @ARGV;
     last if m/^--$/;
     while (m/^-./) {
-        if (s/^-D/-/) {
-            open DEBUG, ">&STDERR" or die $!;
-            DEBUG->autoflush(1);
+        if (0) {
+           # no options
         } else {
             die "$_ ?";
         }
@@ -63,6 +60,17 @@ sub setup () {
 
     $taskid= findtask();
 
+    my $logbase = "hosts-allocate.debug.gz";
+    my $logfh = open_unique_stashfile \$logbase;
+    my $logchild = open DEBUG, "|-";  defined $logchild or die $!;
+    if (!$logchild) {
+       open STDOUT, ">&", $logfh or die $!;
+       exec "gzip" or die $!;
+    }
+    DEBUG->autoflush(1);
+    logm("host allocation debug log in $logbase");
+    $logm_handle = [ $logm_handle, \*DEBUG ];
+
     $fi= $dbh_tests->selectrow_hashref(<<END, {}, $flight);
         SELECT * FROM flights
          WHERE flight = ?
-- 
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®.