From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ian Campbell Subject: Re: [OSSTEST PATCH 05/13] Planner: client side: $mayalloc parameter to $resourcecall->() Date: Thu, 3 Sep 2015 11:52:43 +0100 Message-ID: <1441277563.26292.341.camel@citrix.com> References: <1441208719-31336-1-git-send-email-ian.jackson@eu.citrix.com> <1441208719-31336-6-git-send-email-ian.jackson@eu.citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1ZXS8N-0002xk-Tl for xen-devel@lists.xenproject.org; Thu, 03 Sep 2015 10:52:48 +0000 In-Reply-To: <1441208719-31336-6-git-send-email-ian.jackson@eu.citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Ian Jackson , xen-devel@lists.xenproject.org List-Id: xen-devel@lists.xenproject.org On Wed, 2015-09-02 at 16:45 +0100, Ian Jackson wrote: > 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 Acked-by: Ian Campbell > --- > 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);