]> xenbits.xensource.com Git - osstest.git/commitdiff
power: Do not sleep between power off and power on if not needed
authorIan Jackson <ian.jackson@eu.citrix.com>
Tue, 22 Jan 2019 17:30:04 +0000 (17:30 +0000)
committerIan Jackson <ian.jackson@eu.citrix.com>
Thu, 24 Jan 2019 18:34:34 +0000 (18:34 +0000)
This is controlled by a new query method on power method objects.  If
every power method says it is instananeous then we do not sleep.

This is going to be most useful when we introduce the new SSH
approach, which should not sleep for the power off time.

But we do it for guests (ie, L1 nested hosts) too.

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

index 779ba6c279a00794267e36c8646b5e4da992f0a1..7bed724c3e5d162907830d24b2c04cfabfcf525d 100755 (executable)
@@ -56,4 +56,9 @@ sub pdu_power_state {
     }
 }
 
+sub instantaneous {
+    my ($mo) = @_;
+    return 1;
+}
+
 1;
index aa73c854abf0bc4b22f717eb6765de3691155a6a..37e34301fa9f1080dc5fb03f19eb3a23154ad1d6 100644 (file)
@@ -62,4 +62,9 @@ sub pdu_power_state {
     }
 }
 
+sub instantaneous {
+    my ($mo) = @_;
+    return $mo->{Then}->instantaneous();
+}
+
 1;
index 8627f45252c13ef944756cf0a4827c8bfc6d3977..c914defd2d98f44f381d3f05d8c10303a6419514 100644 (file)
@@ -35,4 +35,9 @@ sub pdu_power_state {
     die "power switch request for $mo->{Host}{Name} ($on) not supported\n";
 }
 
+sub instantaneous {
+    my ($mo) = @_;
+    return 0;
+}
+
 1;
index 5e2fb48876ecbf8aaa8be1bbedb9a772d62f960d..c3b2fb7ba18f825f61672e05ba9dae7c873f781c 100644 (file)
@@ -997,7 +997,14 @@ sub power_reboot_attempts ($$$) {
        if (eval {
            power_approach_invoke($ho, $approach, 0);
            $setup->();
-           power_cycle_sleep($ho);
+           my $need_sleep = 0;
+           foreach my $mo (@{ $approach->{MethObjs} }) {
+               next if $mo eq 'nest';
+               next if $mo->instantaneous();
+               $need_sleep = 1;
+               last;
+           }
+           power_cycle_sleep($ho) if $need_sleep;
            power_approach_invoke($ho, $approach, 1);
            $await->();
            1;