From 8759c66130cbe3a1bb7a2cd8d7b1d8a0c46fbe03 Mon Sep 17 00:00:00 2001 From: zhaoertao Date: Wed, 7 Mar 2012 05:41:13 +0000 Subject: [PATCH] support blade cycle: rpower blade cycle git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@11776 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- perl-xCAT/xCAT/FSPpower.pm | 17 +++++++++-------- perl-xCAT/xCAT/Usage.pm | 4 +++- xCAT-server/lib/xcat/plugins/blade.pm | 2 +- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/perl-xCAT/xCAT/FSPpower.pm b/perl-xCAT/xCAT/FSPpower.pm index bc408074b..6b895a6d3 100644 --- a/perl-xCAT/xCAT/FSPpower.pm +++ b/perl-xCAT/xCAT/FSPpower.pm @@ -214,10 +214,10 @@ sub powercmd { if($action =~ /^off$/) { $action = "cec_off"; } if($action =~ /^resetsp$/) { $action = "reboot_service_processor"; } if($action =~ /^lowpower$/) { $action = "cec_on_low_power"; } - if($action =~ /^reboot$/) {$action = "cec_reboot";} - if($action !~ /^cec_on_autostart$/ && $action !~ /^cec_off$/ && $action !~ /^cec_on_low_power$/ && $action !~ /^onstandby$/ && $action !~ /^reboot_service_processor$/ ) { + if($action =~ /^cycle$/) {$action = "cec_reboot";} + if($action !~ /^cec_on_autostart$/ && $action !~ /^cec_off$/ && $action !~ /^cec_on_low_power$/ && $action !~ /^onstandby$/ && $action !~ /^reboot_service_processor$/ && $action !~ /^cec_reboot$/) { push @output, [$node_name, "\'$action\' command not supported for $$d[4]", -1 ]; - next; + return (\@output); } $newids = $$d[0]; $newnames = $node_name; @@ -232,8 +232,7 @@ sub powercmd { $action = "reboot_service_processor"; } else { push @output, [$node_name, "$node_name\'s type isn't fsp or lpar. Not allow doing this operation", -1 ]; - #return (\@output); - next; + return (\@output); } $newids = $$d[0]; $newnames = $node_name; @@ -285,11 +284,13 @@ sub powercmd { next; } } - push @output, [$node_name,"Success", 0]; + if ((scalar(keys %$hash) == 1) and $Rc) { + push @output, [$node_name, $data, $Rc]; + } else { + push @output, [$node_name,"Success", 0]; + } } - return( \@output ); - } diff --git a/perl-xCAT/xCAT/Usage.pm b/perl-xCAT/xCAT/Usage.pm index 4f18d8840..17a1a701e 100644 --- a/perl-xCAT/xCAT/Usage.pm +++ b/perl-xCAT/xCAT/Usage.pm @@ -35,7 +35,9 @@ my %usage = ( rpower [stat|state|rackstandby|exit_rackstandby|resetsp] LPAR(using Direct FSP Management) specific: rpower [on|off|reset|stat|state|boot|of|sms] - Blade specific: + Blade(using Direct FSP Management) specific: + rpower [on|off|cycle|state] + Blade(using AMM) specific: rpower [cycle|softoff] [-V|--verbose] zVM specific: rpower noderange [on|off|reset|stat|softoff] diff --git a/xCAT-server/lib/xcat/plugins/blade.pm b/xCAT-server/lib/xcat/plugins/blade.pm index e724166f1..9f4fdc356 100644 --- a/xCAT-server/lib/xcat/plugins/blade.pm +++ b/xCAT-server/lib/xcat/plugins/blade.pm @@ -1808,7 +1808,7 @@ sub getmacs { my @allmacs; foreach my $midx ( @midxary) { - (my $macd,my $mac) = split (/:/,$macs[$midx-1],2); + (my $macd,my $mac) = split (/:/,$macs[$midx],2); $mac =~ s/\s+//g; if ($macd !~ /mac address \d/i) { return 1,"Unable to retrieve MAC address for interface $midx from Management Module";