-Have nbroot explicitly try to send packets out of each up interface -Prevent empty /etc/motd warnings -Fix issue where discovery failed with classic MM -Change check for network sameness to a live check instead of table check in nodediscover -Have nbroot quiet by default to alleviate conserver log usage -Have dhcp plugin mac deletion be a bit more aggressive, delete matching mac addresses -Have discovery disable DHCP offers for multiple NICs on the same network if nothing resembling a proper guess can be made git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@866 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
		
			
				
	
	
		
			62 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			Perl
		
	
	
	
	
	
			
		
		
	
	
			62 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			Perl
		
	
	
	
	
	
# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html
 | 
						|
package xCAT_plugin::switch;
 | 
						|
use IO::Socket;
 | 
						|
use Data::Dumper;
 | 
						|
use xCAT::MacMap;
 | 
						|
use Sys::Syslog;
 | 
						|
use Storable;
 | 
						|
 | 
						|
my $macmap;
 | 
						|
sub handled_commands {
 | 
						|
  $macmap = xCAT::MacMap->new();
 | 
						|
  return {
 | 
						|
    findme => 'switch',
 | 
						|
  };
 | 
						|
}
 | 
						|
 | 
						|
sub process_request {
 | 
						|
 my $req = shift;
 | 
						|
 my $cb = shift;
 | 
						|
 my $doreq = shift;
 | 
						|
 my $ip = $req->{'_xcat_clientip'};
 | 
						|
 my $mac = '';
 | 
						|
 my $arptable = `/sbin/arp -n`;
 | 
						|
 my @arpents = split /\n/,$arptable;
 | 
						|
 foreach  (@arpents) {
 | 
						|
   if (m/^($ip)\s+\S+\s+(\S+)\s/) {
 | 
						|
     $mac=$2;
 | 
						|
     last;
 | 
						|
   }
 | 
						|
 }
 | 
						|
 unless ($mac) {
 | 
						|
   return;
 | 
						|
 }
 | 
						|
 my $node = $macmap->find_mac($mac,$req->{cacheonly}->[0]);
 | 
						|
 #if (not $node and $req->{checkallmacs}->[0]) {
 | 
						|
 #   foreach (@{$req->{mac}}) {
 | 
						|
 #      /.*\|.*\|([\dABCDEFabcdef:]+)(\||$)/;
 | 
						|
 #      $node = $macmap->find_mac($1,$req->{cacheonly}->[0]);
 | 
						|
 #      if ($node) { last; }
 | 
						|
 #   }
 | 
						|
 #}
 | 
						|
    
 | 
						|
 if ($node) {
 | 
						|
  my $mactab = xCAT::Table->new('mac',-create=>1);
 | 
						|
  $mactab->setNodeAttribs($node,{mac=>$mac});
 | 
						|
  $mactab->close();
 | 
						|
  #my %request = (
 | 
						|
  #  command => ['makedhcp'],
 | 
						|
  #  node => [$node]
 | 
						|
  #);
 | 
						|
  #$doreq->(\%request);
 | 
						|
  $req->{command}=['discovered'];
 | 
						|
  $req->{noderange} = [$node];
 | 
						|
  $doreq->($req); 
 | 
						|
  %{$req}=();#Clear req structure, it's done..
 | 
						|
  undef $mactab;
 | 
						|
 } else { 
 | 
						|
    #Shouldn't complain, might be blade, but how to log total failures?
 | 
						|
 }
 | 
						|
}
 | 
						|
1;
 |