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.jack...@eu.citrix.com>
---
 Osstest/PDU/guest.pm       | 5 +++++
 Osstest/PDU/try_off.pm     | 5 +++++
 Osstest/PDU/unsupported.pm | 5 +++++
 Osstest/TestSupport.pm     | 9 ++++++++-
 4 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/Osstest/PDU/guest.pm b/Osstest/PDU/guest.pm
index 779ba6c2..7bed724c 100755
--- a/Osstest/PDU/guest.pm
+++ b/Osstest/PDU/guest.pm
@@ -56,4 +56,9 @@ sub pdu_power_state {
     }
 }
 
+sub instantaneous {
+    my ($mo) = @_;
+    return 1;
+}
+
 1;
diff --git a/Osstest/PDU/try_off.pm b/Osstest/PDU/try_off.pm
index aa73c854..37e34301 100644
--- a/Osstest/PDU/try_off.pm
+++ b/Osstest/PDU/try_off.pm
@@ -62,4 +62,9 @@ sub pdu_power_state {
     }
 }
 
+sub instantaneous {
+    my ($mo) = @_;
+    return $mo->{Then}->instantaneous();
+}
+
 1;
diff --git a/Osstest/PDU/unsupported.pm b/Osstest/PDU/unsupported.pm
index 8627f452..c914defd 100644
--- a/Osstest/PDU/unsupported.pm
+++ b/Osstest/PDU/unsupported.pm
@@ -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;
diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm
index 5e2fb488..c3b2fb7b 100644
--- a/Osstest/TestSupport.pm
+++ b/Osstest/TestSupport.pm
@@ -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;
-- 
2.11.0


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

Reply via email to