[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


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Roger Pau Monne <roger.pau@xxxxxxxxxx>
  • Date: Wed, 11 Mar 2020 18:20:07 +0100
  • Authentication-results: esa4.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=roger.pau@xxxxxxxxxx; spf=Pass smtp.mailfrom=roger.pau@xxxxxxxxxx; spf=None smtp.helo=postmaster@xxxxxxxxxxxxxxx
  • Cc: ian.jackson@xxxxxxxxxxxxx, Roger Pau Monne <roger.pau@xxxxxxxxxx>
  • Delivery-date: Wed, 11 Mar 2020 17:20:54 +0000
  • Ironport-sdr: 9A5CT1XPAqn22yzNo8yTIgTiJhOA1WuYw0KGmvCc7Q1QM8EUa9OBelPaYuRlJhwWcAylnkiWhk 5lbMrI5UD/SZgSPW8lCVq1FueAvl4Vo5tlHIih9kaZJQSwfKuY/Yt0P8E6I3XS0mCLyFS3k9VF yV3H2/AsOJNss2qSQX56XwDgS+otcTOAf7nkVteQPEelPktKU06yA+OtkUCBSeUZZJCpr4IQS1 G46U6Y9w5NFG6xhyv2TSkVSNSZzDU2GOD4i3izWGUkYnvmAEpCdcVtYCOeS+rgTO8QMLjwfOSz 3ss=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

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

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.