Introduce a way for the queue daemon to tell its client that it must
not allocate anything in this planning iteration.

In the client:
 * Advertise the new feature via set-info.
 * Accept the `noalloc' part of `!OK think noalloc';
 * Print that in our log message;
 * Honour it by passing it to $resourcecall.

And document the new protocol.  However, there is no server-side yet,
so this does not yet introduce any overall change to the system.

Signed-off-by: Ian Jackson <ian.jack...@eu.citrix.com>
Acked-by: Ian Campbell <ian.campb...@citrix.com>
---
 Osstest/Executive.pm |    9 ++++++---
 README.planner       |    6 +++++-
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/Osstest/Executive.pm b/Osstest/Executive.pm
index f9be0a0..4f51d70 100644
--- a/Osstest/Executive.pm
+++ b/Osstest/Executive.pm
@@ -674,6 +674,7 @@ sub alloc_resources {
                 $set_info->('priority', $priority);
                 $set_info->('sub-priority',$ENV{OSSTEST_RESOURCE_SUBPRIORITY});
                 $set_info->('preinfo',     $ENV{OSSTEST_RESOURCE_PREINFO});
+               $set_info->('feature-noalloc', 1);
 
                 if (defined $waitstart) {
                     $set_info->('wait-start',$waitstart);
@@ -699,7 +700,9 @@ sub alloc_resources {
 
             logm("resource allocation: awaiting our slot...");
 
-            $_= <$qserv>;  defined && m/^\!OK think\s$/ or die "$_ ?";
+            $_= <$qserv>;
+           defined && m/^\!OK think( noalloc)?\s$/ or die "$_ ?";
+           my $noalloc = $1 // '';
 
             opendb_tests();
 
@@ -715,12 +718,12 @@ sub alloc_resources {
                read($qserv, $jplan, $jplanlen) == $jplanlen or die $!;
                my $jplanprint= $jplan;
                chomp $jplanprint;
-               logm("resource allocation: obtained base plan.");
+               logm("resource allocation: obtained base plan$noalloc.");
                $debugm->("base plan = ", $jplanprint);
                $plan= from_json($jplan);
            }, sub {
                if (!eval {
-                   ($ok, $bookinglist) = $resourcecall->($plan, 1);
+                   ($ok, $bookinglist) = $resourcecall->($plan, !$noalloc);
                    1;
                }) {
                    warn "resourcecall $@";
diff --git a/README.planner b/README.planner
index ef2acba..52f757b 100644
--- a/README.planner
+++ b/README.planner
@@ -194,11 +194,15 @@ ms-queuedaemon commands
         > set-info sub-priority ...                  } queue adjustment
         > set-info wait-start-adjust ...             }
 
+        > set-info feature-noalloc 1
+               The client understands `!OK think noalloc'.
+
        > wait
                I want to join the plan
 
-       < !OK think
+       < !OK think [noalloc]
                Now is the time to add yourself to the plan
+                `noalloc' means client must not not actually allocate.
 
                > get-plan
                < OK get-plan BYTES
-- 
1.7.10.4


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

Reply via email to