]> xenbits.xensource.com Git - osstest.git/commitdiff
Planner: client side: New `!OK think noalloc' protocol
authorIan Jackson <ian.jackson@eu.citrix.com>
Tue, 1 Sep 2015 13:56:46 +0000 (14:56 +0100)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Tue, 8 Sep 2015 10:29:19 +0000 (11:29 +0100)
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.Jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Osstest/Executive.pm
README.planner

index f9be0a02b65f886824d5c285c31caea22210b985..4f51d706f5b5d8b1b9c75ae17b0bca030d63bfb5 100644 (file)
@@ -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 $@";
index ef2acba3d8e3f3396ddb3beb9b1405ecbcc5690e..52f757b1a4c5b143ae01acfa6a04dc25c3a3efbb 100644 (file)
@@ -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