Message ID | 20170706144227.36580-11-roger.pau@citrix.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Roger Pau Monne writes ("[PATCH v4 10/16] osstest: add support for runtime_IDENT_hostflags"): > This is required for FreeBSD, that will need to set some of the > hostflags at runtime. The current IDENT_hostflags will be keep as-is, > and they should only be set at job creation time. > > Also introduce a helper to set the runtime hostflags. ... > @@ -1587,10 +1587,17 @@ sub get_hostflags ($) { > my ($ident) = @_; > # may be run outside transaction, or with flights locked > my $flags= get_runvar_default('all_hostflags', $job, '').','. > - get_runvar_default("${ident}_hostflags", $job, ''); > + get_runvar_default("${ident}_hostflags", $job, '').','. > + get_runvar_default("runtime_${ident}_hostflags", $job, ''); VG. > +sub set_runtime_hostflag ($$) { > + my ($ident,$value) = @_; > + > + store_runvar("runtime_${ident}_hostflags", $value); This function suggests that you can do this set_runtime_hostflag('host', 'freebsd-version-4.7'); set_runtime_hostflag('host', 'share-host-freebsd-4.7-xxxx-yyyy'); but of course that won't work. I like the implied interface better than the one which implicitly overwrites all previous runtime hostflags. Should set_runtime_hostflag take a $ho, instead ? Can you ever see us using it without a $ho ? If not then it probably should. Ian.
On Thu, Jul 06, 2017 at 04:28:09PM +0100, Ian Jackson wrote: > Roger Pau Monne writes ("[PATCH v4 10/16] osstest: add support for runtime_IDENT_hostflags"): > > +sub set_runtime_hostflag ($$) { > > + my ($ident,$value) = @_; > > + > > + store_runvar("runtime_${ident}_hostflags", $value); > > This function suggests that you can do this > set_runtime_hostflag('host', 'freebsd-version-4.7'); > set_runtime_hostflag('host', 'share-host-freebsd-4.7-xxxx-yyyy'); > but of course that won't work. > > I like the implied interface better than the one which implicitly > overwrites all previous runtime hostflags. Right. > Should set_runtime_hostflag take a $ho, instead ? Can you ever see us > using it without a $ho ? If not then it probably should. I'm sorry but I don't follow. I'm not sure how I'm supposed to use the $ho parameter, neither get_hostflags or store_runvar take such a parameter. From the text above I thought that you wanted something like: sub set_runtime_hostflag ($$) { my ($ident,$value) = @_; $value .= ','.get_runvar_default("runtime_${ident}_hostflags", $job, ''); store_runvar("runtime_${ident}_hostflags", $value); } But I'm not sure. Thanks, Roger.
Roger Pau Monne writes ("Re: [PATCH v4 10/16] osstest: add support for runtime_IDENT_hostflags"): > On Thu, Jul 06, 2017 at 04:28:09PM +0100, Ian Jackson wrote: > > I like the implied interface better than the one which implicitly > > overwrites all previous runtime hostflags. > > Right. > > > Should set_runtime_hostflag take a $ho, instead ? Can you ever see us > > using it without a $ho ? If not then it probably should. > > I'm sorry but I don't follow. I'm not sure how I'm supposed to use the > $ho parameter, neither get_hostflags or store_runvar take such a > parameter. From the text above I thought that you wanted something > like: You can get $ident from $ho->{Ident}. > sub set_runtime_hostflag ($$) { > my ($ident,$value) = @_; > > $value .= ','.get_runvar_default("runtime_${ident}_hostflags", $job, ''); > store_runvar("runtime_${ident}_hostflags", $value); > } > > But I'm not sure. Yes, something like that, only taking $ho rather than $ident. Also your proposed computation is slightly wrong in that it will produce ,FLAG I would use split and join. Ian.
On Thu, Jul 06, 2017 at 04:28:09PM +0100, Ian Jackson wrote: > Should set_runtime_hostflag take a $ho, instead ? Can you ever see us > using it without a $ho ? If not then it probably should. I don't think I can do that. This script runs before the host allocation. Thanks, Roger.
Roger Pau Monne writes ("Re: [PATCH v4 10/16] osstest: add support for runtime_IDENT_hostflags"): > On Thu, Jul 06, 2017 at 04:28:09PM +0100, Ian Jackson wrote: > > Should set_runtime_hostflag take a $ho, instead ? Can you ever see us > > using it without a $ho ? If not then it probably should. > > I don't think I can do that. This script runs before the host > allocation. Oh. So it does. Yes, it must take an ident then. Sorry. Ian.
diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm index 94ace09c..1c5455ee 100644 --- a/Osstest/TestSupport.pm +++ b/Osstest/TestSupport.pm @@ -79,7 +79,7 @@ BEGIN { selecthost get_hostflags get_host_property get_target_property get_host_native_linux_console - hostnamepath hostnamepath_list + hostnamepath hostnamepath_list set_runtime_hostflag power_state power_cycle power_cycle_sleep serial_fetch_logs propname_massage propname_check @@ -1587,10 +1587,17 @@ sub get_hostflags ($) { my ($ident) = @_; # may be run outside transaction, or with flights locked my $flags= get_runvar_default('all_hostflags', $job, '').','. - get_runvar_default("${ident}_hostflags", $job, ''); + get_runvar_default("${ident}_hostflags", $job, '').','. + get_runvar_default("runtime_${ident}_hostflags", $job, ''); return grep /./, split /\,/, $flags; } +sub set_runtime_hostflag ($$) { + my ($ident,$value) = @_; + + store_runvar("runtime_${ident}_hostflags", $value); +} + sub host_involves_pcipassthrough ($) { my ($ho) = @_; return !!grep m/^pcipassthrough\-/, get_hostflags($ho->{Ident});
This is required for FreeBSD, that will need to set some of the hostflags at runtime. The current IDENT_hostflags will be keep as-is, and they should only be set at job creation time. Also introduce a helper to set the runtime hostflags. Signed-off-by: Roger Pau Monné <roger.pau@citrix.com> --- Changes since v3: - New in this version --- Osstest/TestSupport.pm | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)