All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH OSSTEST] get_hostflags: return an empty list when there is no flight/job.
@ 2015-07-29 16:28 Ian Campbell
  2015-07-31 15:31 ` Ian Jackson
  0 siblings, 1 reply; 5+ messages in thread
From: Ian Campbell @ 2015-07-29 16:28 UTC (permalink / raw)
  To: ian.jackson, xen-devel; +Cc: Ian Campbell

From: Ian Campbell <Ian.Campbell@citrix.com>

Otherwise trying to use mg-hosts mkpxedir fails with:

$ OSSTEST_CONFIG=production-config-cambridge ./mg-hosts mkpxedir -n rice-weevil
2015-07-27 10:12:28 Z serial method sympathy rice-weevil: osstser1.xs.citrite.net /root/sympathy/rice-weevil /root/sympathy/rice-weevil.log*
2015-07-27 10:12:28 Z TftpScope is default
2015-07-27 10:12:28 Z task 260549 static ianc@osstest: ianc@osstest manual
Use of uninitialized value $otherflightjob in pattern match (m//) at Osstest.pm line 308.
Use of uninitialized value $otherflightjob in pattern match (m//) at Osstest.pm line 308.
Use of uninitialized value $otherflightjob in concatenation (.) or string at Osstest.pm line 308.
 ? at Osstest.pm line 308.

Signed-off-by: Ian Campbell <Ian.Campbell@citrix.com>
---
 Osstest/TestSupport.pm | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm
index 4696d68..19d643a 100644
--- a/Osstest/TestSupport.pm
+++ b/Osstest/TestSupport.pm
@@ -1292,6 +1292,7 @@ sub git_dir_revision ($$) {
 sub get_hostflags ($) {
     my ($ident) = @_;
     # may be run outside transaction, or with flights locked
+    return () unless $flight && $job;
     my $flags= get_runvar_default('all_hostflags',     $job, '').','.
                get_runvar_default("${ident}_hostflags", $job, '');
     return grep /./, split /\,/, $flags;
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH OSSTEST] get_hostflags: return an empty list when there is no flight/job.
  2015-07-29 16:28 [PATCH OSSTEST] get_hostflags: return an empty list when there is no flight/job Ian Campbell
@ 2015-07-31 15:31 ` Ian Jackson
  2015-07-31 15:39   ` Ian Campbell
  0 siblings, 1 reply; 5+ messages in thread
From: Ian Jackson @ 2015-07-31 15:31 UTC (permalink / raw)
  To: Ian Campbell; +Cc: xen-devel

Ian Campbell writes ("[PATCH OSSTEST] get_hostflags: return an empty list when there is no flight/job."):
> From: Ian Campbell <Ian.Campbell@citrix.com>
> 
> 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@eu.citrix.com>

Ian.

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH OSSTEST] get_hostflags: return an empty list when there is no flight/job.
  2015-07-31 15:31 ` Ian Jackson
@ 2015-07-31 15:39   ` Ian Campbell
  2015-08-05 10:50     ` Ian Campbell
  0 siblings, 1 reply; 5+ messages in thread
From: Ian Campbell @ 2015-07-31 15:39 UTC (permalink / raw)
  To: Ian Jackson; +Cc: xen-devel

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@citrix.com>
> > 
> > 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@eu.citrix.com>

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@citrix.com>

Ian.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH OSSTEST] get_hostflags: return an empty list when there is no flight/job.
  2015-07-31 15:39   ` Ian Campbell
@ 2015-08-05 10:50     ` Ian Campbell
  2015-08-11 15:57       ` Ian Campbell
  0 siblings, 1 reply; 5+ messages in thread
From: Ian Campbell @ 2015-08-05 10:50 UTC (permalink / raw)
  To: Ian Jackson; +Cc: xen-devel

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@citrix.com>
> > > 
> > > 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@eu.citrix.com>
> 
> 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@citrix.com>

I fabricated some sort of commit message and pushed to pretest.

commit 2e51119a34d06162b69275f38010130193d5501e
Author: Ian Jackson <Ian.Jackson@eu.citrix.com>
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@eu.citrix.com>
    Acked-by: Ian Campbell <ian.campbell@citrix.com>
    [ 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} }

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH OSSTEST] get_hostflags: return an empty list when there is no flight/job.
  2015-08-05 10:50     ` Ian Campbell
@ 2015-08-11 15:57       ` Ian Campbell
  0 siblings, 0 replies; 5+ messages in thread
From: Ian Campbell @ 2015-08-11 15:57 UTC (permalink / raw)
  To: Ian Jackson; +Cc: xen-devel

On Wed, 2015-08-05 at 11:50 +0100, Ian Campbell wrote:
> 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@citrix.com>
> > > > 
> > > > 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@eu.citrix.com>
> > 
> > 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@citrix.com>
> 
> I fabricated some sort of commit message and pushed to pretest.
> 
> commit 2e51119a34d06162b69275f38010130193d5501e
> Author: Ian Jackson <Ian.Jackson@eu.citrix.com>
> 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@eu.citrix.com>
>     Acked-by: Ian Campbell <ian.campbell@citrix.com>
>     [ ijc -- wrong commit message ]

I really meant wrote here, sorry. It's through the gate now though.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-08-11 15:57 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-29 16:28 [PATCH OSSTEST] get_hostflags: return an empty list when there is no flight/job Ian Campbell
2015-07-31 15:31 ` Ian Jackson
2015-07-31 15:39   ` Ian Campbell
2015-08-05 10:50     ` Ian Campbell
2015-08-11 15:57       ` Ian Campbell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.