From 45d902c128faf368668f7a868fc6cbbb3092e9d6 Mon Sep 17 00:00:00 2001 From: daniceexi Date: Mon, 21 Sep 2009 11:30:05 +0000 Subject: [PATCH] fix some minor problems git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@4176 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- perl-xCAT/xCAT/PPCenergy.pm | 14 +++++------ xCAT-client/pods/man1/renergy.1.pod | 36 ++++++++++++++--------------- xCAT-client/xCAT-client.spec | 1 + xCAT-server/lib/perl/xCAT/PPC.pm | 8 +++---- 4 files changed, 30 insertions(+), 29 deletions(-) diff --git a/perl-xCAT/xCAT/PPCenergy.pm b/perl-xCAT/xCAT/PPCenergy.pm index a6038e3aa..c50876e45 100644 --- a/perl-xCAT/xCAT/PPCenergy.pm +++ b/perl-xCAT/xCAT/PPCenergy.pm @@ -1,4 +1,4 @@ -# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html +# IBM(c) 2009 EPL license http://www.eclipse.org/legal/epl-v10.html package xCAT::PPCenergy; @@ -116,7 +116,7 @@ sub parse_args { return (&usage()); } - if (!grep (/$q_attr/, @no_dup_query_list)) { + if (!grep (/^$q_attr$/, @no_dup_query_list)) { push @no_dup_query_list, $q_attr; } } @@ -159,6 +159,7 @@ sub parse_args { push @notfspnodes, $node; } } + $nodetype_tb->close(); if (@notfspnodes) { return (1, "Error: The hardware type of following nodes are not fsp: ".join(',', @notfspnodes)); @@ -205,7 +206,7 @@ sub renergy { # Check the existence of cim client if ( (! -f $::CIM_CLIENT_PATH) || (! -x $::CIM_CLIENT_PATH) ) { - return ([[$node, "ERROR: Cannot find the xCAT CIM Client [$::CIM_CLIENT_PATH]. Please install the xCAT_cim_client package correctly.", 1]]); + return ([[$node, "ERROR: Cannot find the xCAT CIM Client [$::CIM_CLIENT_PATH] or it's NOT executable. Please install the xCAT-cimclient package correctly.", 1]]); } # Generate the url path for CIM communication @@ -233,15 +234,14 @@ sub renergy { $SIG{CHLD} = (); # Call the xCAT_cim_client to query or set the energy capabilities - my @result = `$cmd 2>&1`; - my $rc = $? >> 8; - + my @result = xCAT::Utils->runcmd("$cmd", -1); + foreach my $line (@result) { chomp($line); if ($line =~ /^\s*$/) { next; } - push @return_msg, [$node, $line, $rc]; + push @return_msg, [$node, $line, $::RUNCMD_RC]; } return \@return_msg; diff --git a/xCAT-client/pods/man1/renergy.1.pod b/xCAT-client/pods/man1/renergy.1.pod index 882bc99a0..762774a69 100644 --- a/xCAT-client/pods/man1/renergy.1.pod +++ b/xCAT-client/pods/man1/renergy.1.pod @@ -25,23 +25,23 @@ a machine. Presently, it only supports IBM POWER6 rack-mounted servers. Note: The keyword 'server' in this document is identical to 'rack-mounted server'. -The parameter 'noderange' can be a list of server's name (CEC's name). -Note: Lpar's name is not acceptable. +The parameter 'noderange' can be a list of node names (CEC's name). +Note: Lpar name is not acceptable. -Renergy command can accept multiple attributes to query. If only +B command can accept multiple attributes to query. If only keywords list is specified, without the '=', it displays the current value. -Renergy command only can set one attribute once running. +B command can only set one attribute once running. -For the attributes that not supported by certain server, the return +For the attributes that are not supported by certain server, the return value will be 'na'. Prerequisite: -Before running the Renergy command, a prerequisite package -B needs to be downloaded form IBM web site and installed. +Before running the B command, a prerequisite package +B needs to be downloaded from IBM web site and installed. Note: Each query operation for attribute CPUspeed, averageAC or averageDC -costs about 30 Second to complete the operation. Query others attributes +costs about 30 seconds to complete. Query for the others attributes will get response immediately. @@ -54,7 +54,7 @@ The energy capability of specific hardware: Supports attributes: savingstatus,CPUspeed,ambienttemp, exhausttemp,averageAC -9117-MMA (cpu speed should quicker than 4G) +9117-MMA (cpu speed should greater than 4.0 GHz) Supports attributes: powersaving =head1 B @@ -66,7 +66,7 @@ The energy capability of specific hardware: Display the version information. -V - Display the Verbose information. + Verbose output. all @@ -86,7 +86,7 @@ savingstatus={on | off} cappingstatus Query the Power Capping status. The result should be - 'on' of 'off'. + 'on' or 'off'. cappingstatus={on | off} Set the Power Capping status. The value must be 'on' @@ -95,16 +95,16 @@ cappingstatus={on | off} cappingwatt=watt Set the Power Capping value base on the watt unit. If the 'watt' > maximum of cappingmaxmin or 'watt' - < minimum of cappingmaxmim, The setting operation + < minimum of cappingmaxmim, the setting operation will fail. cappingperc=percentage Set the Power Capping value base on the percentage of - the max-min capping value. + the max-min of capping value. cappingmaxmin Query the maximum and minimum of Power Capping value - that can be set for a machine. (Unit is watt) + that can be set for a CEC. (Unit is watt) cappingvalue Query the current Power Capping value. (Unit is watt) @@ -115,7 +115,7 @@ cappingsoftmin averageAC Query the average power consumed (Input). (Unit is watt) - Note: For HI and HE server, the value of attribute + Note: For 9125 and 9119 server, the value of attribute averageAC is the aggregate for all of the servers in the rack. @@ -124,10 +124,10 @@ averageDC watt) ambienttemp - Query the current ambient temperature. (Unit is B0C) + Query the current ambient temperature. (Unit is centigrade) exhausttemp - Query the current exhaust temperature. (Unit is B0C) + Query the current exhaust temperature. (Unit is centigrade) CPUspeed Query the effective CPU speed. (Unit is MHz) @@ -187,7 +187,7 @@ CPUspeed 4. Set the Power Capping value base on the percentage of the max-min capping value - B CEC1 -s cappingperc=50 + B CEC1 cappingperc=50 If the maximum capping value of the CEC1 is 850w, and the minimum capping value of the CEC1 is 782w, the Power Capping diff --git a/xCAT-client/xCAT-client.spec b/xCAT-client/xCAT-client.spec index a64f75c88..482dd3af2 100644 --- a/xCAT-client/xCAT-client.spec +++ b/xCAT-client/xCAT-client.spec @@ -133,6 +133,7 @@ ln -sf ../bin/xcatclient $RPM_BUILD_ROOT/%{prefix}/bin/lsvm ln -sf ../bin/xcatclient $RPM_BUILD_ROOT/%{prefix}/bin/chvm ln -sf ../bin/xcatclient $RPM_BUILD_ROOT/%{prefix}/bin/tabgrep ln -sf ../bin/xcatclient $RPM_BUILD_ROOT/%{prefix}/bin/updatenode +ln -sf ../bin/xcatclient $RPM_BUILD_ROOT/%{prefix}/bin/renergy ln -sf ../bin/xcatclientnnr $RPM_BUILD_ROOT/%{prefix}/bin/lsslp ln -sf ../bin/xcatclientnnr $RPM_BUILD_ROOT/%{prefix}/sbin/tabdump ln -sf ../bin/xcatclientnnr $RPM_BUILD_ROOT/%{prefix}/sbin/packimage diff --git a/xCAT-server/lib/perl/xCAT/PPC.pm b/xCAT-server/lib/perl/xCAT/PPC.pm index 73900edd7..a1688d2a4 100644 --- a/xCAT-server/lib/perl/xCAT/PPC.pm +++ b/xCAT-server/lib/perl/xCAT/PPC.pm @@ -1038,11 +1038,11 @@ sub invoke_cmd { ######################################## # Format and send back to parent ######################################## - foreach ( @$result ) { + foreach my $line ( @$result ) { my %output; - $output{node}->[0]->{name}->[0] = @$_[0]; - $output{node}->[0]->{data}->[0]->{contents}->[0] = @$_[1]; - $output{errorcode} = @$_[2]; + $output{node}->[0]->{name}->[0] = @$line[0]; + $output{node}->[0]->{data}->[0]->{contents}->[0] = @$line[1]; + $output{errorcode} = @$line[2]; push @outhash, \%output; } my $out = $request->{pipe};