]> xenbits.xensource.com Git - osstest.git/commitdiff
power: power_reboot_attempts: Honour an $approach_re
authorIan Jackson <ian.jackson@eu.citrix.com>
Tue, 22 Jan 2019 17:58:54 +0000 (17:58 +0000)
committerIan Jackson <ian.jackson@eu.citrix.com>
Thu, 24 Jan 2019 18:40:21 +0000 (18:40 +0000)
The semantics are slightly different here: not specifying it means to
try everything rather than only the hardest.  But the effect is
similar: not specifying $approach_re means we must succeed.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Osstest/TestSupport.pm

index 96ddbc3c23393a66aed1a5f827fb3ec9a87a82f1..4e1192d4bf5f6ad7885e5c506a4403da0a9187ea 100644 (file)
@@ -978,8 +978,8 @@ sub power_cycle_host_setup ($) {
     $ho->{PowerApproaches} = \@approaches;
 }
 
-sub power_reboot_attempts ($$$) {
-    my ($ho, $setup, $await) = @_;
+sub power_reboot_attempts ($$$;$) {
+    my ($ho, $setup, $await, $approach_re) = @_;
     # Power cycles $ho, calling $setup->() while it is (supposedly) off.
     # Then, just after turning $ho on, calls $await->().
     # If $await->() succeeds, great: returns.
@@ -997,6 +997,7 @@ sub power_reboot_attempts ($$$) {
        MethObjs => power_cycle_parse_method($ho, 'ssh'),
     };
     foreach my $approach ($ssh, @{ $ho->{PowerApproaches} }) {
+       next if defined $approach_re && $approach->{Name} !~ qr{$approach_re};
        logm("power: trying to reboot $ho->{Name} (using $approach->{Name})");
        if (eval {
            power_approach_invoke($ho, $approach, 0);