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

[Xen-devel] [OSSTEST PATCH 05/32] mg-hosts: Provide new "power" subcommand



Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---
 mg-hosts |   13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/mg-hosts b/mg-hosts
index a6f6e6e..6ec8d56 100755
--- a/mg-hosts
+++ b/mg-hosts
@@ -122,6 +122,19 @@ END
     }
 }
 
+sub cmd_power () {
+    die unless @ARGV==2;
+    my ($host,$power) = @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);
+    } else {
+       power_cycle($ho);
+    }
+}
+
 sub cmd_create_like () {
     die unless @ARGV==2;
     my ($src,$dsts) = @ARGV;
-- 
1.7.10.4


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

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