|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH OSSTEST] get_hostflags: return an empty list when there is no flight/job.
On Fri, 2015-07-31 at 16:39 +0100, Ian Campbell wrote:
> On Fri, 2015-07-31 at 16:31 +0100, Ian Jackson wrote:
> > Ian Campbell writes ("[PATCH OSSTEST] get_hostflags: return an empty
> > list
> > when there is no flight/job."):
> > > From: Ian Campbell <Ian.Campbell@xxxxxxxxxx>
> > >
> > > Otherwise trying to use mg-hosts mkpxedir fails with:
> >
> > I think your proposed fix is incorrect. It is wrong to call
> > get_hostflags outside the context of a job, because get_hostflags is
> > supposed to return the job's host flags for that ident.
> >
> > The bug was introduced by me in 11e788f7 "JobDB/Executive: Improve an
> > internal `die' error", where a refactoring meant that we always call
> > get_hostflags.
> >
> > How about this instead ?
> >
> > diff --git a/Osstest/JobDB/Executive.pm b/Osstest/JobDB/Executive.pm
> > index 1ec947e..cc52f57 100644
> > --- a/Osstest/JobDB/Executive.pm
> > +++ b/Osstest/JobDB/Executive.pm
> > @@ -128,7 +128,7 @@ sub host_check_allocated ($$) { #method
> > $ho->{Shared} &&
> > $ho->{Shared}{State} eq 'ready';
> > my $harness = get_harness_rev();
> > - my @flags = get_hostflags($ho->{Ident});
> > + my @flags = defined($job) ? get_hostflags($ho->{Ident}) :
> > qw(OUTSIDE
> > -JOB);
> > $ho->{SharedReady}=
> > $ho->{SharedMaybeOthers} &&
> > !! (grep { $_." ".$harness eq "share-".$ho->{Shared}{Type} }
> >
> > Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
>
> LGTM, I suppose the use of the OUTSIDE-JOB sentinel value is just for the
> benefit of the reader of the following die() should it occur.
>
> Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
I fabricated some sort of commit message and pushed to pretest.
commit 2e51119a34d06162b69275f38010130193d5501e
Author: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
Date: Wed Aug 5 11:42:10 2015 +0100
Executive: Support host_check_allocated outside a job.
When called outside a job there are no hostflags, so get_hostflags
cannot be used. Instead assume a new pseudo-flag "OUTSIDE-JOB" when
there is no $job.
Otherwise uses of select_host such as "mg-hosts mkpxedir" fail.
Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
[ ijc -- wrong commit message ]
diff --git a/Osstest/JobDB/Executive.pm b/Osstest/JobDB/Executive.pm
index 1ec947e..cc52f57 100644
--- a/Osstest/JobDB/Executive.pm
+++ b/Osstest/JobDB/Executive.pm
@@ -128,7 +128,7 @@ sub host_check_allocated ($$) { #method
$ho->{Shared} &&
$ho->{Shared}{State} eq 'ready';
my $harness = get_harness_rev();
- my @flags = get_hostflags($ho->{Ident});
+ my @flags = defined($job) ? get_hostflags($ho->{Ident}) : qw(OUTSIDE-JOB);
$ho->{SharedReady}=
$ho->{SharedMaybeOthers} &&
!! (grep { $_." ".$harness eq "share-".$ho->{Shared}{Type} }
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |