From ec067311efa69e4bbac91159f7d25f4fc6e035cc Mon Sep 17 00:00:00 2001 From: ertaozh Date: Thu, 4 Jun 2015 05:48:25 -0400 Subject: [PATCH] support hardware discovery for non-pbmc node defined --- perl-xCAT/xCAT/Utils.pm | 22 +++++++++++++------- xCAT-server/lib/xcat/plugins/nodediscover.pm | 5 ++--- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/perl-xCAT/xCAT/Utils.pm b/perl-xCAT/xCAT/Utils.pm index bc8a1d50b..fc05bbf43 100644 --- a/perl-xCAT/xCAT/Utils.pm +++ b/perl-xCAT/xCAT/Utils.pm @@ -4403,24 +4403,32 @@ sub disableservice{ } sub cleanup_for_powerLE_hardware_discovery { - my $host_node = shift; - if( $host_node =~ /xCAT::Utils/) + my $request = shift; + if( $request =~ /xCAT::Utils/) { - $host_node=shift; + $request=shift; } - my $pbmc_node = shift; my $subreq = shift; + my $host_node = $request->{node}->[0]; + my $pbmc_node = undef; + if (defined($request->{pbmc_node}) and defined($request->{pbmc_node}->[0])) { + $pbmc_node = $request->{pbmc_node}->[0]; + } + my $ipmitab = xCAT::Table->new("ipmi"); unless($ipmitab) { xCAT::MsgUtils->message("S", "Discovery Error: can not open ipmi table."); return; } - my @nodes = ($host_node, $pbmc_node); - my $ipmihash = $ipmitab->getNodesAttribs(\@nodes, ['node', 'bmc', 'username', 'password']); + my $ipmihash = $ipmitab->getNodesAttribs([$host_node], ['node', 'bmc', 'username', 'password']); if ($ipmihash) { my $new_bmc_ip = $ipmihash->{$host_node}->[0]->{bmc}; my $new_bmc_password = $ipmihash->{$host_node}->[0]->{password}; - + if (!defined($pbmc_node)) { + xCAT::MsgUtils->message("S", "Discover info: configure static BMC ip:$new_bmc_ip for host_node:$host_node."); + `rspconfig $host_node ip=$new_bmc_ip`; + return; + } xCAT::MsgUtils->message("S", "Discovery info: configure password for pbmc_node:$pbmc_node."); `rspconfig $pbmc_node password=$new_bmc_password`; #if ($new_bmc_password) { diff --git a/xCAT-server/lib/xcat/plugins/nodediscover.pm b/xCAT-server/lib/xcat/plugins/nodediscover.pm index 70afae632..c15d2f1e1 100644 --- a/xCAT-server/lib/xcat/plugins/nodediscover.pm +++ b/xCAT-server/lib/xcat/plugins/nodediscover.pm @@ -356,9 +356,8 @@ sub process_request { $callback->({error=> ["The node [$node] should have a correct IP address which belongs to the management network."], errorcode=>["1"]}); return; } - if (defined ($request->{pbmc_node}) and defined($request->{pbmc_node}->[0]) ) { - my $pbmc_node = $request->{pbmc_node}->[0]; - xCAT::Utils->cleanup_for_powerLE_hardware_discovery($node, $pbmc_node, $doreq); + if ($request->{arch}->[0] =~ /ppc/ and $request->{platform}->[0] =~ /PowerNV/) { + xCAT::Utils->cleanup_for_powerLE_hardware_discovery($request, $doreq); } my $restartstring = "restart";