From d8b7c905a67d28c6008a835697b2c0980a1e1b3b Mon Sep 17 00:00:00 2001 From: daniceexi Date: Fri, 12 Apr 2013 08:12:12 +0000 Subject: [PATCH] Change how to get the bmc for a predefined node git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/branches/2.8@15968 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/xcat/plugins/seqdiscovery.pm | 37 +++++++++----------- 1 file changed, 17 insertions(+), 20 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/seqdiscovery.pm b/xCAT-server/lib/xcat/plugins/seqdiscovery.pm index 50249fecb..78308f8e0 100644 --- a/xCAT-server/lib/xcat/plugins/seqdiscovery.pm +++ b/xCAT-server/lib/xcat/plugins/seqdiscovery.pm @@ -79,7 +79,7 @@ sub findme { last; } } - + unless ($mac) { xCAT::MsgUtils->message("S", "Discovery Error: Could not find the mac of the $ip."); return; @@ -127,18 +127,16 @@ sub findme { if ($hostip->{'ip'}) { $skiphostip = 1; } - + + my $bmcip = $hosttab->getNodeAttribs($node."-bmc", ['ip']); + if ($bmcip->{'ip'}) { + $skipbmcip = 1; + } + my $ipmitab = xCAT::Table->new('ipmi'); unless ($ipmitab) { xCAT::MsgUtils->message("S", "Discovery Error: Could not open table: ipmi."); } - my $ipmibmc = $ipmitab->getNodeAttribs($node, ['bmc']); - if ($ipmibmc->{'bmc'}) { - $skipbmcip = 1; - unless ($ipmibmc->{'bmc'} =~ /\d+\.\d+\.\d+\.\d+/) { - push @newhosts, $ipmibmc->{'bmc'}; - } - } # set the host ip and bmc if needed unless ($skiphostip) { @@ -151,22 +149,19 @@ sub findme { $hosttab->commit(); } - my $bmcname; + my $bmcname = $node."-bmc"; + push @newhosts, $bmcname; unless ($skipbmcip) { my $bmcip = getfreeips($param{'bmciprange'}, \@allnodes, "bmc"); unless ($bmcip) { nodediscoverstop($callback, undef, "bmc ips"); return; } - $bmcname = $node."-bmc"; $hosttab->setNodeAttribs($bmcname, {ip => $bmcip}); $hosttab->commit(); - - # set the bmc to the ipmi table - $ipmitab->setNodeAttribs($node, {bmc => $bmcname}); - - push @newhosts, $bmcname; } + # set the bmc to the ipmi table + $ipmitab->setNodeAttribs($node, {bmc => $bmcname}); # update the host ip pair to /etc/hosts, it's necessary for discovered and makedhcp commands if (@newhosts) { @@ -292,7 +287,7 @@ Usage: Sequential Discovery: nodediscoverstart noderange= [hostiprange=] [bmciprange=] [groups=] [rack=] [chassis=] [height=] [unit=] Profile Discovery: - nodediscoverstart networkprofile= imageprofile= hostnameformat= [hardwareprofile=] [groups=] [rack=] [chassis=] [height=] [unit=]"; + nodediscoverstart networkprofile= imageprofile= hostnameformat= [hardwareprofile=] [groups=] [rack=] [chassis=] [height=] [unit=] [rank=rank-num]"; $rsp = (); push @{$rsp->{data}}, $usageinfo; xCAT::MsgUtils->message("I", $rsp, $cb); @@ -376,7 +371,7 @@ Usage: my @PCMdiscover = xCAT::TableUtils->get_site_attribute("__PCMDiscover"); if ($PCMdiscover[0]) { my $rsp; - push @{$rsp->{data}}, "Sequentail Discovery cannot run together with Profile-based discovery"; + push @{$rsp->{data}}, "Sequentail Discovery cannot be run together with Profile-based discovery"; xCAT::MsgUtils->message("E", $rsp, $callback, 1); return; } @@ -542,6 +537,7 @@ Usage: my @PCMDiscover = xCAT::TableUtils->get_site_attribute("__PCMDiscover"); if ($PCMDiscover[0]) { # return directly that profile discover will cover it + return; } elsif (!$SEQDiscover[0]) { # Neither of profile nor sequential was running my $rsp; @@ -782,8 +778,9 @@ Usage: push @{$rsp->{data}}, " The parameters used for discovery: ".$SEQDiscover[0]; xCAT::MsgUtils->message("I", $rsp, $callback); } elsif ($PCMDiscover[0]) { - # return directly that Profile discover to cover the output - return; + my $rsp; + push @{$rsp->{data}}, "Node discovery for all nodes using profiles is running"; + xCAT::MsgUtils->message("I", $rsp, $callback); } else { my $rsp; push @{$rsp->{data}}, "Sequential Discovery is stopped.";