|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH OSSTEST v5 3/5] ts-examine-hostprops-save: record hostflags also
Commit putative hotflags into the database if present on the runvars.
Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
---
Changes since v4:
- New in this version.
---
Requested by Ian on IRC:
17:08:58 Diziet royger: I think your ts-examine-hostprops-save hunk in 2/
belongs in 1/ ? (Or in
a separate 1.5/ along with hostflag_putative_record.)
---
Osstest/TestSupport.pm | 8 +++++++-
ts-examine-hostprops-save | 23 ++++++++++++++---------
2 files changed, 21 insertions(+), 10 deletions(-)
diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm
index ceb6bb7b..1c13e2af 100644
--- a/Osstest/TestSupport.pm
+++ b/Osstest/TestSupport.pm
@@ -86,7 +86,7 @@ BEGIN {
power_state power_cycle power_reboot_attempts
serial_fetch_logs set_host_property modify_host_flag
propname_massage propname_check
- hostprop_putative_record
+ hostprop_putative_record hostflag_putative_record
get_stashed open_unique_stashfile compress_stashed
dir_identify_vcs
@@ -1417,6 +1417,12 @@ sub modify_host_flag ($$$) {
$mhostdb->modify_flag($ho, $flag, $set);
}
+sub hostflag_putative_record ($$$) {
+ my ($ho, $prop, $set) = @_;
+
+ store_runvar("hostflag/$ho->{Ident}/$prop", !!$set);
+}
+
sub get_target_property ($$;$);
sub get_target_property ($$;$) {
my ($ho, $prop, $defval) = @_;
diff --git a/ts-examine-hostprops-save b/ts-examine-hostprops-save
index 55d23392..e50ea7fb 100755
--- a/ts-examine-hostprops-save
+++ b/ts-examine-hostprops-save
@@ -27,20 +27,25 @@ tsreadconfig();
our $blessing = intended_blessing();
-logm("setting host properties");
+logm("setting host properties and flags");
# NB: in order to aid debug only attempt to save the host props on flights
# with intended real blessing, for the rest just do a dry run.
our $dry_run = $blessing ne "real";
-logm("not saving host props with intended blessing $blessing != real")
+logm("not saving host props/flags with intended blessing $blessing != real")
if $dry_run;
foreach my $k (sort keys %r) {
- next unless $k =~ m/^hostprop\/([^\/]*)\/([^\/]*)$/;
- my $ho = selecthost($1);
- my $prop = $2;
-
- logm("recording for $ho->{Name} $prop=$r{$k}");
-
- set_host_property($ho, $prop, $r{$k}) if !$dry_run;
+ next unless $k =~ m/^host(prop|flag)\/([^\/]*)\/([^\/]*)$/;
+ my $type = $1;
+ my $ho = selecthost($2);
+ my $prop = $3;
+
+ if ($type eq "flag") {
+ logm("recording flag $prop set: $r{$k} for $ho->{Name}");
+ modify_host_flag($ho, $prop, !!$r{$k}) if !$dry_run;
+ } else {
+ logm("recording prop for $ho->{Name} $prop=$r{$k}");
+ set_host_property($ho, $prop, $r{$k}) if !$dry_run;
+ }
}
--
2.25.0
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |