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

[Xen-devel] [OSSTEST PATCH 09/11] mg-allocate: Support --progress-fd



Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---
 mg-allocate | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/mg-allocate b/mg-allocate
index 87a4e71..2dfbdb1 100755
--- a/mg-allocate
+++ b/mg-allocate
@@ -57,6 +57,8 @@
 #
 #   --info-base=<info>  Replaces `manual' at start of info put into plan.
 #
+#   --progress-fd=<fd>  Print some brief progress messages to <fd>.
+#
 # <task-spec> must exist (and be in a format valid for OSSTEST_TASK).
 
 # This is part of "osstest", an automated testing framework for Xen.
@@ -83,6 +85,7 @@ unshift @INC, qw(.);
 use Osstest;
 use Osstest::TestSupport;
 use Osstest::Executive;
+use IO::Handle;
 
 csreadconfig();
 
@@ -450,6 +453,12 @@ sub plan () {
        logm("best at $planned->{Start} is ".showposs(\@reqlist));
        die unless $planned;
 
+        printf MGA_PROGRESS "%s %s @%d %s\n",
+            (show_abs_time time),
+            ($mayalloc && !$planned->{Start} ? "allocating" : "planned"),
+            $planned->{Start},
+            showposs(\@reqlist);
+
         my $worstok=0;
         if ($mayalloc && !$planned->{Start}) {
             $worstok=1;
@@ -501,6 +510,8 @@ sub plan () {
     loggot(@got);
 }
 
+open MGA_PROGRESS, ">/dev/null" or die $!;
+
 while (@ARGV && $ARGV[0] =~ m/^[-0-9]/) {
     $_= shift @ARGV;
     last if m/^\-\-?$/;
@@ -528,6 +539,9 @@ while (@ARGV && $ARGV[0] =~ m/^[-0-9]/) {
            $allocinfo_base = $1;
        } elsif (s/^--stdout-output$/-/) {
            $stdout_output = 1;
+       } elsif (s/^--progress-fd=(\d+)$/-/) {
+            open MGA_PROGRESS, ">&$1" or die $!;
+            MGA_PROGRESS->autoflush(1);
         } else {
             die "bad option \`$_'";
         }
-- 
2.1.4


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

 


Rackspace

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