pass the powerinterval into fsp-api with on/reset actions

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@11149 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
jjhua 2011-12-07 07:54:44 +00:00
parent f28e3fa945
commit b2e8e59da3
2 changed files with 24 additions and 15 deletions

View File

@ -98,10 +98,12 @@ sub fsp_api_action {
############################
# Get IP address
############################
$fsp_ip = xCAT::Utils::getNodeIPaddress( $fsp_name, $parameter );
#$fsp_ip = xCAT::Utils::getNodeIPaddress( $fsp_name, $parameter );
$fsp_ip = xCAT::Utils::getIPaddress( $fsp_name, $parameter );
undef($parameter);
} else {
$fsp_ip = xCAT::Utils::getNodeIPaddress( $fsp_name );
#$fsp_ip = xCAT::Utils::getNodeIPaddress( $fsp_name );
$fsp_ip = xCAT::Utils::getIPaddress( $fsp_name );
}
if(!defined($fsp_ip)) {
@ -154,6 +156,9 @@ sub fsp_api_action {
if( defined($parameter) ) {
if ($action =~ /^set_(frame|cec|lpar)_name$/) {
$cmd = "$fsp_api -a $action -n $parameter -T $tooltype -t $type:$fsp_ip:$id:$node_name:";
} elsif( $parameter !=0 && $action =~ /^(on|reset)$/ ) {
#powerinterval for lpars power on
$cmd = "$fsp_api -a $action -i $parameter -T $tooltype -t $type:$fsp_ip:$id:$node_name:";
} else {
$cmd = "$fsp_api -a $action -T $tooltype -t $type:$fsp_ip:$id:$node_name:$parameter";
}
@ -173,7 +178,7 @@ sub fsp_api_action {
#################
#$outhash{ $node_name } = $res;
if(defined($res)) {
$res =~ s/$node_name: //;
$res =~ s/$node_name: //g;
}
return( [$node_name,$res, $Rc] );
}
@ -234,8 +239,9 @@ sub fsp_state_action {
############################
# Get IP address
############################
$fsp_ip = xCAT::Utils::getNodeIPaddress( $fsp_name );
if(!defined($fsp_ip)) {
#$fsp_ip = xCAT::Utils::getNodeIPaddress( $fsp_name );
$fsp_ip = xCAT::Utils::getIPaddress( $fsp_name );
if(!defined($fsp_ip) or ($fsp_ip == -3)) {
$res[0] = ["Failed to get the $fsp_name\'s ip"];
return ([-1, @res]);
}
@ -351,8 +357,9 @@ sub fsp_api_create_parttion {
############################
# Get IP address
############################
$fsp_ip = xCAT::Utils::getNodeIPaddress( $fsp_name );
if(!defined($fsp_ip)) {
#$fsp_ip = xCAT::Utils::getNodeIPaddress( $fsp_name );
$fsp_ip = xCAT::Utils::getIPaddress( $fsp_name );
if(!defined($fsp_ip) or ($fsp_ip == -3)) {
$res = "Failed to get the $fsp_name\'s ip";
return ([$fsp_name, $res, -1]);
}

View File

@ -175,7 +175,7 @@ sub powercmd {
my $lpar_flag = 0;
my $cec_flag = 0;
my $frame_flag = 0;
#print "++++in powercmd++++\n";
#print Dumper($hash);
@ -198,7 +198,7 @@ sub powercmd {
foreach $node_name ( keys %$hash)
{
$action = $request->{'op'};
$action = $request->{'op'};
my $d = $hash->{$node_name};
if ($$d[4] =~ /^lpar$/) {
if( !($action =~ /^(on|off|of|reset|sms)$/)) {
@ -227,7 +227,9 @@ sub powercmd {
$action = "enter_rack_standby";
} elsif ( $action=~/^exit_rackstandby$/) {
$action = "exit_rack_standby";
} else {
} elsif ($action =~ /^resetsp$/) {
$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;
@ -239,19 +241,19 @@ sub powercmd {
}
if( $lpar_flag && $cec_flag) {
push @output, [$node_name," $node_name\'s type is different from the last name. The noderange of power control operation could NOT be lpar/cec mixed" , -1 ];
push @output, [$node_name," $node_name\'s type is different from the last node. The noderange of power control operation could NOT be lpar/cec mixed" , -1 ];
return (\@output);
}
if( $lpar_flag && $frame_flag) {
push @output, [$node_name," $node_name\'s type is different from the last name. The noderange of power control operation could NOT be lpar/frame mixed" , -1 ];
push @output, [$node_name," $node_name\'s type is different from the last node. The noderange of power control operation could NOT be lpar/frame mixed" , -1 ];
return (\@output);
}
if( $cec_flag && $frame_flag) {
push @output, [$node_name," $node_name\'s type is different from the last name. The noderange of power control operation could NOT be cec/frame mixed" , -1 ];
push @output, [$node_name," $node_name\'s type is different from the last node. The noderange of power control operation could NOT be cec/frame mixed" , -1 ];
return (\@output);
}
@ -261,8 +263,8 @@ sub powercmd {
$$newd[0] = $newids;
#print Dumper($newd);
my $res = xCAT::FSPUtils::fsp_api_action($newnames, $newd, $action );
my $res = xCAT::FSPUtils::fsp_api_action($newnames, $newd, $action, 0, $request->{'powerinterval'} );
# print "In boot, state\n";
# print Dumper($res);
my $Rc = @$res[2];