| 
    
 [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [OSSTEST PATCH 08/26] power: power_reboot_attempts: Try multiple approaches
 Actually iterate over PowerApproaches, rather than calling power_state
with no approach selector regexp.
No overall functional change right now because nothing puts more
than one entry in PowerApproaches.
Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---
 Osstest/TestSupport.pm | 21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)
diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm
index fa7c36e1..d1b7ad66 100644
--- a/Osstest/TestSupport.pm
+++ b/Osstest/TestSupport.pm
@@ -960,11 +960,22 @@ sub power_reboot_attempts ($$$) {
     # to work.  $setup and $await should tolerate this situation; in
     # particular $await must only succeed if the host really did reboot
     # into the boot environment that $await expects.
-    power_state($ho, 0);
-    $setup->();
-    power_cycle_sleep($ho);
-    power_state($ho, 1);
-    $await->();
+    foreach my $approach (@{ $ho->{PowerApproaches} }) {
+       logm("power: rebooting $ho->{Name} (using $approach->{Name})");
+       if (eval {
+           power_approach_invoke($ho, $approach, 0);
+           $setup->();
+           power_cycle_sleep($ho);
+           power_approach_invoke($ho, $approach, 1);
+           $await->();
+           1;
+       }) {
+           logm("power: rebooted $ho->{Name} (using $approach->{Name})");
+           return;
+       }
+       logm("power: failed to reboot (using $approach->{Name}): $@");
+    }
+    die "power: all approaches to rebooting $ho->{Name} failed!\n";
 }
 
 sub power_cycle_sleep ($) {
-- 
2.11.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  |