If no time is specified, use 120 (or the PowerOnTime host property
value) when powering on, or 10 when powering off.

This is all intended to be used like this:
  HostProp_rimava0_PowerMethod nest; msw --apc6 pdu2 19; pause; ipmi rimava0m

This means:
  * For power on, first turn on the APC PDU pdu2 port 19
  * Wait 120s (or HostProp_rimava0_PowerOnTime)
  * Then ipmi to the host name rimava0m with ADMIN/ADMIN
    (or HostProp_rimava0_IpmiUser/HostProp_rimava0_IpmiPassword)
  * For power off, do that in reverse, only with a 10s pause.

Signed-off-by: Ian Jackson <[email protected]>
---
 Osstest/PDU/pause.pm   | 5 +++++
 Osstest/TestSupport.pm | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/Osstest/PDU/pause.pm b/Osstest/PDU/pause.pm
index b1160c0..9e839c6 100644
--- a/Osstest/PDU/pause.pm
+++ b/Osstest/PDU/pause.pm
@@ -36,6 +36,11 @@ BEGIN {
 
 sub new {
     my ($class, $ho, $methname, $on, $off) = @_;
+    if (!defined $on) {
+        $on = get_host_property($ho, 'PowerOnTime', 120);
+        $off = 10;
+    }
+    $off //= $on;
     return bless [ $off, $on ], $class;
 }
 
diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm
index 004e644..ea54601 100644
--- a/Osstest/TestSupport.pm
+++ b/Osstest/TestSupport.pm
@@ -924,7 +924,7 @@ sub power_cycle_host_setup ($) {
             push @$methobjs, $meth;
         } elsif ($meth =~ m{^(\d+)(?:/(\d+))$}) {
             require Osstest::PDU::pause;
-            push @$methobjs, new Osstest::PDU::pause $ho, 'pause', $1, $2//$1;
+            push @$methobjs, new Osstest::PDU::pause $ho, 'pause', $1, $2;
         } else {
             push @$methobjs, get_host_method_object($ho,'PDU',$meth);
         }
-- 
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

Reply via email to