]> xenbits.xensource.com Git - people/royger/osstest.git/commitdiff
osstest: add support for runtime_IDENT_hostflags
authorRoger Pau Monne <roger.pau@citrix.com>
Wed, 13 Jun 2018 07:40:15 +0000 (09:40 +0200)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Thu, 21 Jun 2018 15:56:55 +0000 (16:56 +0100)
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>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
Changes since v4:
 - Allow runtime flags to be appended instead of overwritten.

Changes since v3:
 - New in this version.

Osstest/TestSupport.pm

index 78538f2ac0c772e3468ab805fe1035f2674c54f3..79737ea4b5df294c45d00bd984359da6eeaee246 100644 (file)
@@ -80,7 +80,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 set_host_property
                       propname_massage propname_check
@@ -1596,10 +1596,20 @@ 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) = @_;
+    my @current = split /,/, get_runvar_default("runtime_${ident}_hostflags",
+                                                $job, '');
+
+    push @current, (split /,/, $value);
+    store_runvar("runtime_${ident}_hostflags", (join ',', @current));
+}
+
 sub host_involves_pcipassthrough ($) {
     my ($ho) = @_;
     return !!grep m/^pcipassthrough\-/, get_hostflags($ho->{Ident});