mirror of
				https://github.com/xcat2/xcat-core.git
				synced 2025-10-31 11:22:27 +00:00 
			
		
		
		
	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
This commit is contained in:
		| @@ -163,7 +163,7 @@ if [ "$PLATFORM" != "unknown" ]; then | ||||
|         echo "<platform>$PLATFORM</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/ //'` | ||||
|   | ||||
| @@ -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) | ||||
|   | ||||
| @@ -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'; | ||||
|   | ||||
| @@ -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); | ||||
|  | ||||
|   | ||||
| @@ -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'; | ||||
|   | ||||
| @@ -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 ); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user