[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [OSSTEST PATCH 21/26] power: Record approach used for power cycles in runvars



Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---
 Osstest/TestSupport.pm | 17 +++++++++++++----
 ts-host-install        |  2 +-
 ts-logs-capture        |  2 +-
 3 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm
index fb14c4b3..334cc2cb 100644
--- a/Osstest/TestSupport.pm
+++ b/Osstest/TestSupport.pm
@@ -981,12 +981,15 @@ sub power_cycle_host_setup ($) {
     $ho->{PowerApproaches} = \@approaches;
 }
 
-sub power_reboot_attempts ($$$;$) {
-    my ($ho, $setup, $await, $approach_re) = @_;
+sub power_reboot_attempts ($$$;$$) {
+    my ($ho, $setup, $await, $approach_re, $record_runvar_tail) = @_;
     # Power cycles $ho, calling $setup->() while it is (supposedly) off.
     # Then, just after turning $ho on, calls $await->().
     # If $await->() succeeds, great: returns.
     #
+    # Records the method used in the synth runvar IDENT_power_TAIL
+    # (a comma-separated list)
+    #
     # If it fails (dies), power_reboot_attempts will attempt to power
     # cycle $ho using a more certain method and call $fn again.  This
     # may occur multiple times.
@@ -1018,6 +1021,12 @@ sub power_reboot_attempts ($$$;$) {
            1;
        }) {
            logm("power: rebooted $ho->{Name} (using $approach->{Name})");
+           if (defined $record_runvar_tail) {
+               my $rv = "$ho->{Ident}_power_${record_runvar_tail}";
+               my $newval = $r{$rv}.(!!length($r{$rv}) and ',')
+                   .$approach->{Name};
+               store_runvar($rv, $newval);
+           }
            return;
        }
        logm("power: failed to reboot (using $approach->{Name}): $@");
@@ -1441,8 +1450,8 @@ sub target_reboot ($) {
     await_tcp(get_timeout($ho,'reboot',$timeout{RebootUp}), 5,$ho);
 }
 
-sub target_reboot_force ($) {
-    my ($ho) = @_;
+sub target_reboot_force ($;$) {
+    my ($ho, $record_runvar_tail) = @_;
     power_reboot_attempts($ho, sub { }, sub {
         await_tcp(get_timeout($ho,'reboot',$timeout{HardRebootUp}), 5, $ho);
     }, qr{(?!.*SSH)});
diff --git a/ts-host-install b/ts-host-install
index 068242eb..292733ba 100755
--- a/ts-host-install
+++ b/ts-host-install
@@ -71,7 +71,7 @@ END
        my $logtailer= Osstest::Logtailer->new($c{WebspaceLog});
        my $timeout = get_timeout($ho,'reboot',$timeout{ReadPreseed});
        await_webspace_fetch_byleaf($timeout, 1, $logtailer, $ho, $ps_url);
-    });
+    }, undef, "install");
 
     if ($poweron_test_only) {
        logm("Hooray, power on worked.");
diff --git a/ts-logs-capture b/ts-logs-capture
index fe3b0813..a429bb76 100755
--- a/ts-logs-capture
+++ b/ts-logs-capture
@@ -175,7 +175,7 @@ sub fetch_logs_host () {
     if (!try_fetch_logs($ho, $logs)) {
         logm("log fetching failed, trying hard host reboot...");
         if (!eval {
-            target_reboot_force($ho);
+            target_reboot_force($ho, 'recover');
             1;
         }) {
             logm("host reboot failed, abandoning log fetches: $@");
-- 
2.11.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®.