Change `./ms-planner unprocessed' to take a file of infos on stdin,
and when we restart the planning, invoke it once.

(This would be an incompatible change to the planner, needing a
queuedaemon restart, if this patch were applied separately from the
previous "Report unprocessed planning clients".)

Signed-off-by: Ian Jackson <ian.jack...@eu.citrix.com>
---
v2: New patch
---
 ms-planner     |   10 +++++++---
 ms-queuedaemon |   18 +++++++++++-------
 2 files changed, 18 insertions(+), 10 deletions(-)

diff --git a/ms-planner b/ms-planner
index 495c8ff..47e0ea7 100755
--- a/ms-planner
+++ b/ms-planner
@@ -756,11 +756,15 @@ sub cmd_show_html () {
 }
 
 sub cmd_unprocessed () {
-    die unless @ARGV==1;
-    my ($baseinfo) = @ARGV;
+    die unless @ARGV==0;
 
     get_current_plan();
-    push @{ $plan->{Unprocessed} }, { Info => $baseinfo };
+
+    while (<STDIN>) {
+       chomp;
+       push @{ $plan->{Unprocessed} }, { Info => $_ };
+    }
+
     check_write_new_plan();
 }
 
diff --git a/ms-queuedaemon b/ms-queuedaemon
index 29b906f..a249b50 100755
--- a/ms-queuedaemon
+++ b/ms-queuedaemon
@@ -483,10 +483,10 @@ proc restarter-restart-now {} {
        log-event "restarter-restart-now projection-running"
     }
 
-    foreach skip [set plan/queue_running] {
-       for-chan $skip {
-           chan-note-unprocessed plan $skip
-       }
+    if {[catch {
+       chans-note-unprocessed plan [set plan/queue_running]
+    } emsg]} {
+       log "INTERNAL ERROR setting unprocessed: $emsg"
     }
     report-plan plan plan
 
@@ -494,8 +494,12 @@ proc restarter-restart-now {} {
     runneeded-ensure-will 2
 }
 
-proc chan-note-unprocessed {w chan} {
-    exec ./ms-planner -w$w unprocessed [chan-plan-info $chan]
+proc chans-note-unprocessed {w chans} {
+    set data {}
+    foreach chan $chans {
+       append data [chan-plan-info $chan] "\n"
+    }
+    exec ./ms-planner -w$w unprocessed << $data
 }
 
 proc notify-to-think {w thinking} {
@@ -506,7 +510,7 @@ proc notify-to-think {w thinking} {
            projection.1 { puts-chan $thinking "!OK think noalloc" }
            projection.* {
                # oh well, can't include it in the projection; too bad
-               chan-note-unprocessed $w $thinking
+               chans-note-unprocessed $w [list $thinking]
                queuerun-step-done $w "!feature-noalloc"
            }
        }
-- 
1.7.10.4


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

Reply via email to