[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [OSSTEST PATCH 15/26] power: Honour approach_re in power_cycle and mg-hosts power



Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---
 Osstest/TestSupport.pm |  8 ++++----
 mg-hosts               | 14 +++++++++-----
 2 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm
index 8101b739..e45f54b2 100644
--- a/Osstest/TestSupport.pm
+++ b/Osstest/TestSupport.pm
@@ -1028,15 +1028,15 @@ sub power_cycle_sleep ($) {
     sleep($to);
 }
 
-sub power_cycle ($) {
-    my ($ho) = @_;
+sub power_cycle ($;$) {
+    my ($ho, $approach_re) = @_;
     $mjobdb->host_check_allocated($ho);
     die "refusing to set power state for host $ho->{Name}".
        " possibly shared with other jobs\n"
        if $ho->{SharedMaybeOthers};
-    power_state($ho, 0);
+    power_state($ho, 0, $approach_re);
     power_cycle_sleep($ho);
-    power_state($ho, 1);
+    power_state($ho, 1, $approach_re);
 }
 
 sub power_approach_invoke ($$$) {
diff --git a/mg-hosts b/mg-hosts
index 5361eb63..2edf1216 100755
--- a/mg-hosts
+++ b/mg-hosts
@@ -24,12 +24,16 @@
 #               of osstest.  Will use "sudo". The HOST(s) must be
 #               allocated (via mg-allocate HOST).
 #
-#  ./mg-hosts power HOST ACTION
+#  ./mg-hosts power HOST ACTION [APPROACH_RE]
 #               Power cycles the host. Host must be allocated to the current
 #               user.  Actions are:
 #                "0" or "on"    : power on
 #                "1" or "off"   : power off
 #                "c" or "r"     : reboot
+#               APPROACH_RE is a regexp specifying which method to
+#               use.  Methods are:  Only ILOM PDU SSH
+#               and the lightest method which matches will be used.
+#               If not specified, the most reliable method will be used.
 #
 #  ./mg-hosts create-like SOURCE-HOST NEW-HOST[,NEW-HOST...]
 #               Create new host(s).  This does NOT copy the
@@ -151,15 +155,15 @@ END
 }
 
 sub cmd_power () {
-    die unless @ARGV==2;
-    my ($host,$power) = @ARGV;
+    die unless @ARGV==2 || @ARGV==3;
+    my ($host,$power,$approach_re) = @ARGV;
     $_ = $power;
     $power = m/^1|^on/ ? 1 : m/^0|^off/ ? 0 : m/^r|^c/ ? -1 : die;
     my $ho= selecthost("host=$host");
     if ($power >= 0) {
-       power_state($ho, $power);
+       power_state($ho, $power, $approach_re);
     } else {
-       power_cycle($ho);
+       power_cycle($ho, $approach_re);
     }
 }
 
-- 
2.11.0


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

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.