xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Ian Jackson <ian.jackson@eu.citrix.com>
To: xen-devel@lists.xenproject.org
Cc: Ian Jackson <Ian.Jackson@eu.citrix.com>,
	Ian Campbell <ian.campbell@citrix.com>
Subject: [OSSTEST PATCH 05/13] Planner: client side: $mayalloc parameter to $resourcecall->()
Date: Wed, 2 Sep 2015 16:45:11 +0100	[thread overview]
Message-ID: <1441208719-31336-6-git-send-email-ian.jackson@eu.citrix.com> (raw)
In-Reply-To: <1441208719-31336-1-git-send-email-ian.jackson@eu.citrix.com>

Add a new parameter to $resourcecall which allows the alloc_resources
loop in Osstest::Executive to specify to its clients that on this
occasion they should not make any actual allocations.

The callers of alloc_resources are all adjusted to honour this new
parameter:
 * ts-hosts-allocate-Executive avoids allocating unless $mayalloc
 * mg-allocate avoids allocating unless $mayalloc
 * mg-blockage never allocates anyway.

Currently we always pass 1, so no functional change.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
---
 Osstest/Executive.pm        |    4 ++--
 mg-allocate                 |    4 ++--
 mg-blockage                 |    2 +-
 ts-hosts-allocate-Executive |    4 ++--
 4 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/Osstest/Executive.pm b/Osstest/Executive.pm
index ab015d2..f9be0a0 100644
--- a/Osstest/Executive.pm
+++ b/Osstest/Executive.pm
@@ -604,7 +604,7 @@ sub plan_search ($$$$) {
 }
 
 sub alloc_resources {
-    my ($resourcecall) = pop @_; # $resourcecall->($plan);
+    my ($resourcecall) = pop @_; # $resourcecall->($plan, $mayalloc);
     my (%xparams) = @_;
     # $resourcecall should die (abort) or return ($ok, $bookinglist)
     #
@@ -720,7 +720,7 @@ sub alloc_resources {
 		$plan= from_json($jplan);
 	    }, sub {
 		if (!eval {
-		    ($ok, $bookinglist) = $resourcecall->($plan);
+		    ($ok, $bookinglist) = $resourcecall->($plan, 1);
 		    1;
 		}) {
 		    warn "resourcecall $@";
diff --git a/mg-allocate b/mg-allocate
index fc1b394..6dc7ddd 100755
--- a/mg-allocate
+++ b/mg-allocate
@@ -270,7 +270,7 @@ sub showposs ($) {
 sub plan () {
     my @got;
     alloc_resources(sub {
-        my ($plan) = @_;
+        my ($plan, $mayalloc) = @_;
 
 	@got = ();
         my @possmatrix = ([]);
@@ -310,7 +310,7 @@ sub plan () {
 	die unless $planned;
 
         my $allok=0;
-        if (!$planned->{Start}) {
+        if ($mayalloc && !$planned->{Start}) {
             $allok=1;
 
             alloc_prep();
diff --git a/mg-blockage b/mg-blockage
index a21f15b..1f66d8e 100755
--- a/mg-blockage
+++ b/mg-blockage
@@ -40,7 +40,7 @@ sub max { (reverse sort @_)[0]; }
 
 sub plan () {
     alloc_resources(sub {
-	my ($plan) = @_;
+	my ($plan, $mayalloc) = @_;
 
 	my $now = time;
 	if ($now > $end) { return (1, { Bookings => [ ] }); }
diff --git a/ts-hosts-allocate-Executive b/ts-hosts-allocate-Executive
index 7a9411d..6e1391e 100755
--- a/ts-hosts-allocate-Executive
+++ b/ts-hosts-allocate-Executive
@@ -606,7 +606,7 @@ sub alloc_hosts () {
 }
 
 sub attempt_allocation {
-    ($plan) = @_;
+    ($plan, $mayalloc) = @_;
     undef $best;
 
     logm("allocating hosts: ".join(' ', map { $_->{Ident} } @hids));
@@ -632,7 +632,7 @@ sub attempt_allocation {
 
     my $retval=0;
 
-    if (!$best->{Start}) {
+    if ($mayalloc && !$best->{Start}) {
 	$retval= 1;
 	foreach my $hid (@hids) {
 	    my $got= actual_allocation($hid);
-- 
1.7.10.4

  parent reply	other threads:[~2015-09-02 15:51 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-02 15:45 [OSSTEST RFC PATCH 00/13] Planner: Performance improvement Ian Jackson
2015-09-02 15:45 ` [OSSTEST PATCH 01/13] Tcl: Use lshift instead of open-coding with lrange Ian Jackson
2015-09-03 10:44   ` Ian Campbell
2015-09-03 10:50     ` Ian Jackson
2015-09-02 15:45 ` [OSSTEST PATCH 02/13] Planner: docs: Minor fixes Ian Jackson
2015-09-03 10:47   ` Ian Campbell
2015-09-03 12:04     ` Ian Jackson
2015-09-02 15:45 ` [OSSTEST PATCH 03/13] Planner: docs: Document set-info command Ian Jackson
2015-09-03 10:48   ` Ian Campbell
2015-09-02 15:45 ` [OSSTEST PATCH 04/13] Planner: Fix indefinite holdoff Ian Jackson
2015-09-03 10:51   ` Ian Campbell
2015-09-02 15:45 ` Ian Jackson [this message]
2015-09-03 10:52   ` [OSSTEST PATCH 05/13] Planner: client side: $mayalloc parameter to $resourcecall->() Ian Campbell
2015-09-02 15:45 ` [OSSTEST PATCH 06/13] Planner: client side: New `!OK think noalloc' protocol Ian Jackson
2015-09-03 10:53   ` Ian Campbell
2015-09-02 15:45 ` [OSSTEST PATCH 07/13] Planner: ms-planner support -w option Ian Jackson
2015-09-03 11:25   ` Ian Campbell
2015-09-02 15:45 ` [OSSTEST PATCH 08/13] Planner: ms-queuedaemon: Prep for multiple walkers Ian Jackson
2015-09-03 12:05   ` Ian Campbell
2015-09-03 15:42     ` Ian Jackson
2015-09-02 15:45 ` [OSSTEST PATCH 09/13] Planner: ms-queuedaemon: Synchronise thinking " Ian Jackson
2015-09-03 12:06   ` Ian Campbell
2015-09-02 15:45 ` [OSSTEST PATCH 10/13] Planner: ms-queuedaemon: Break out queuerun-finished/<walker> Ian Jackson
2015-09-03 12:43   ` Ian Campbell
2015-09-02 15:45 ` [OSSTEST PATCH 11/13] Planner: ms-queuedaemon: Break out notify-to-think Ian Jackson
2015-09-03 12:44   ` Ian Campbell
2015-09-02 15:45 ` [OSSTEST PATCH 12/13] Planner: ms-queuedaemon: Make report-plan take output walker name Ian Jackson
2015-09-03 12:44   ` Ian Campbell
2015-09-02 15:45 ` [OSSTEST PATCH 13/13] Planner: ms-queuedaemon: Restart planning when resources become free Ian Jackson
2015-09-03 12:59   ` Ian Campbell
2015-09-03 11:49 ` [OSSTEST PATCH 14/13] Planning reports: Break out return-plan-to-client Ian Jackson
2015-09-03 11:49   ` [OSSTEST PATCH 15/13] Plan reporting: Provide get-last-plan queuedaemon command Ian Jackson
2015-09-03 13:05     ` Ian Campbell
2015-09-03 15:51       ` Ian Jackson
2015-09-03 15:52         ` Ian Jackson
2015-09-03 16:12           ` Ian Campbell
2015-09-03 13:01   ` [OSSTEST PATCH 14/13] Planning reports: Break out return-plan-to-client Ian Campbell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1441208719-31336-6-git-send-email-ian.jackson@eu.citrix.com \
    --to=ian.jackson@eu.citrix.com \
    --cc=ian.campbell@citrix.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).