From b9624793536bc26fa7fac7d50a6ab722b8d49709 Mon Sep 17 00:00:00 2001 From: Bin Xu Date: Wed, 28 Feb 2018 18:08:25 +0800 Subject: [PATCH] Fix the issue: Failed to discover nodes as the discovery method is set to udef by wrong (#4860) - zvmdiscovery plugin will not handle findme - not change request if no temp discovered bmc nodes, to avoid the confusing error message - add more logs, and ignore the `ipmitool sol info` error output --- xCAT-genesis-scripts/usr/bin/dodiscovery | 2 +- xCAT-genesis-scripts/usr/bin/minixcatd.awk | 4 ++++ xCAT-server/lib/xcat/plugins/aaadiscovery.pm | 6 +++++- xCAT-server/lib/xcat/plugins/nodediscover.pm | 4 ++-- xCAT-server/lib/xcat/plugins/switch.pm | 2 +- xCAT-server/lib/xcat/plugins/zvmdiscovery.pm | 7 ++++++- 6 files changed, 19 insertions(+), 6 deletions(-) diff --git a/xCAT-genesis-scripts/usr/bin/dodiscovery b/xCAT-genesis-scripts/usr/bin/dodiscovery index e3ff40825..5a554c0af 100755 --- a/xCAT-genesis-scripts/usr/bin/dodiscovery +++ b/xCAT-genesis-scripts/usr/bin/dodiscovery @@ -163,7 +163,7 @@ if [ "$PLATFORM" != "unknown" ]; then echo "$PLATFORM" >> /tmp/discopacket fi -LANCHAN=$(ipmitool sol info |awk '/Payload Channel/{print $4}') +LANCHAN=$(ipmitool sol info 2>/dev/null|awk '/Payload Channel/{print $4}') IsStatic=`ipmitool lan print $LANCHAN | grep 'IP Address Source' | grep 'Static'` if [ "$IsStatic" ]; then BMCIPADDR=`ipmitool lan print $LANCHAN | grep 'IP Address' | grep -v 'IP Address Source' | cut -d ":" -f2 | sed 's/ //'` diff --git a/xCAT-genesis-scripts/usr/bin/minixcatd.awk b/xCAT-genesis-scripts/usr/bin/minixcatd.awk index c0231a579..d00d1b2f3 100755 --- a/xCAT-genesis-scripts/usr/bin/minixcatd.awk +++ b/xCAT-genesis-scripts/usr/bin/minixcatd.awk @@ -11,12 +11,16 @@ BEGIN { quit="yes" system("echo \"" $0 "\" > /restart") close(listener) + system("rm -rf /processing") + system("logger -s -t 'xcat.genesis.minixcatd' -p local4.info 'The request is processed by xCAT master successfully.'") }else if(match($0,"processing")){ print "processing request" |& listener system("echo \"" $0 "\" > /processing") + system("logger -s -t 'xcat.genesis.minixcatd' -p local4.info 'The request is processing by xCAT master...'") }else if(match($0,"processed")){ print "finished request process" |& listener system("rm -rf /processing") + system("logger -s -t 'xcat.genesis.minixcatd' -p local4.warning 'The request is already processed by xCAT master, but not matched.'") } } close(listener) diff --git a/xCAT-server/lib/xcat/plugins/aaadiscovery.pm b/xCAT-server/lib/xcat/plugins/aaadiscovery.pm index 235c016b5..e52123d80 100644 --- a/xCAT-server/lib/xcat/plugins/aaadiscovery.pm +++ b/xCAT-server/lib/xcat/plugins/aaadiscovery.pm @@ -36,13 +36,17 @@ sub process_request { $arptable = `/sbin/arp -n`; } my @arpents = split /\n/, $arptable; - my $mac = "$req->{mtm}->[0]*$req->{serial}->[0]"; + my $mac; foreach (@arpents) { if (m/^($client_ip)\s+\S+\s+(\S+)\s/) { $mac = $2; last; } } + unless ($mac) { + xCAT::MsgUtils->message("S", "xcat.discovery.aaadiscovery: Failed to get MAC address for $client_ip in arp cache."); + $mac = "$req->{mtm}->[0]*$req->{serial}->[0]"; + } xCAT::MsgUtils->message("S", "xcat.discovery.aaadiscovery: ($mac) Got a discovery request, attempting to discover the node..."); $req->{discoverymethod}->[0] = 'undef'; diff --git a/xCAT-server/lib/xcat/plugins/nodediscover.pm b/xCAT-server/lib/xcat/plugins/nodediscover.pm index c357000eb..d65bb9d8a 100644 --- a/xCAT-server/lib/xcat/plugins/nodediscover.pm +++ b/xCAT-server/lib/xcat/plugins/nodediscover.pm @@ -459,7 +459,7 @@ sub process_request { if (defined($request->{bmcinband})) { if (defined($request->{bmc_node}) and defined($request->{bmc_node}->[0])) { my $bmc_node = $request->{bmc_node}->[0]; - xCAT::MsgUtils->message("S", "xcat.discovery.nodediscover: Removing discovered node definition: $bmc_node..."); + xCAT::MsgUtils->message("S", "xcat.discovery.nodediscover: Removing discovered BMC nodes definition: $bmc_node..."); my $rmcmd = "rmdef $bmc_node"; xCAT::Utils->runcmd($rmcmd, 0); if ($::RUNCMD_RC != 0) @@ -495,7 +495,7 @@ sub process_request { Timeout => '1', Proto => 'tcp' ); - unless ($sock) { xCAT::MsgUtils->message("S", "xcat.discovery.nodediscover: Failed to notify $clientip that it's actually $node."); return; } + unless ($sock) { xCAT::MsgUtils->message("S", "xcat.discovery.nodediscover: Failed to notify $clientip that it's actually $node. $node has not been discovered."); return; } print $sock $restartstring; close($sock); diff --git a/xCAT-server/lib/xcat/plugins/switch.pm b/xCAT-server/lib/xcat/plugins/switch.pm index 1ace2fffb..8823ec029 100644 --- a/xCAT-server/lib/xcat/plugins/switch.pm +++ b/xCAT-server/lib/xcat/plugins/switch.pm @@ -371,7 +371,7 @@ sub process_request { my $request = {%$req}; $request->{command} = ['discovered']; $request->{noderange} = [$node]; - $request->{bmc_node} = [$bmc_node]; + $request->{bmc_node} = [$bmc_node] if $bmc_node; $doreq->($request); if (defined($request->{error})) { $req->{error}->[0] = '1'; diff --git a/xCAT-server/lib/xcat/plugins/zvmdiscovery.pm b/xCAT-server/lib/xcat/plugins/zvmdiscovery.pm index 66d5e6808..a243963cf 100644 --- a/xCAT-server/lib/xcat/plugins/zvmdiscovery.pm +++ b/xCAT-server/lib/xcat/plugins/zvmdiscovery.pm @@ -852,7 +852,7 @@ sub getSiteVal { #------------------------------------------------------- sub handled_commands { return { - findme => 'zvmdiscovery', + #findme => 'zvmdiscovery', # Not handle findme in this plugin, #4860 #nodediscoverdef => 'zvmdiscovery', # Handled by sequential discovery nodediscoverls => 'zvmdiscovery', nodediscoverstart => 'zvmdiscovery', @@ -1710,6 +1710,11 @@ sub process_request { my $args = $request->{arg}; if ($command eq "findme"){ + if (defined($request->{discoverymethod}) and defined($request->{discoverymethod}->[0]) and ($request->{discoverymethod}->[0] ne 'undef')) { + + # The findme request had been processed by other module, just return + return; + } findme( $request, $callback, $request_command ); } elsif ($command eq "nodediscoverls") { nodediscoverls( $callback, $args );