-Support explicit discovery nic specification
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@4746 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
parent
0dab1d959a
commit
8dede44fa5
@ -356,7 +356,7 @@ nodepos => {
|
||||
},
|
||||
},
|
||||
noderes => {
|
||||
cols => [qw(node servicenode netboot tftpserver nfsserver monserver nfsdir installnic primarynic cmdinterface xcatmaster current_osimage next_osimage nimserver comments disable)],
|
||||
cols => [qw(node servicenode netboot tftpserver nfsserver monserver nfsdir installnic primarynic discoverynics cmdinterface xcatmaster current_osimage next_osimage nimserver comments disable)],
|
||||
keys => [qw(node)],
|
||||
table_desc => 'Resources and settings to use when installing nodes.',
|
||||
descriptions => {
|
||||
@ -369,6 +369,7 @@ noderes => {
|
||||
nfsdir => 'Not used! The path that should be mounted from the NFS server.',
|
||||
installnic => 'The network adapter on the node that will be used for OS deployment. If not set, primarynic will be used.',
|
||||
primarynic => 'The network adapter on the node that will be used for xCAT management. Default is eth0.',
|
||||
discoverynics => 'If specified, force discovery to occur on specific network adapters only, regardless of detected connectivity. Syntax can be simply "eth2,eth3" to restrict discovery to whatever happens to come up as eth2 and eth3, or by driver name such as "bnx2:0,bnx2:1" to specify the first two adapters managed by the bnx2 driver',
|
||||
defnetname => 'The host (or ip) by which a node should be addressed (i.e. in psh/pscp). By default, nodename is assumed to be equal to this',
|
||||
xcatmaster => 'The hostname of the xCAT service node (as known by this node). This is the default value if nfsserver or tftpserver are not set.',
|
||||
current_osimage => 'Not currently used. The name of the osimage data object that represents the OS image currently deployed on this node.',
|
||||
|
@ -88,6 +88,8 @@ sub process_request {
|
||||
my $node = $request->{node}->[0];
|
||||
my $ip = $request->{'_xcat_clientip'};
|
||||
openlog("xCAT node discovery",'','local0');
|
||||
|
||||
|
||||
#First, fill in tables with data fields..
|
||||
if (defined($request->{mtm}) or defined($request->{serial})) {
|
||||
my $vpdtab = xCAT::Table->new("vpd",-create=>1);
|
||||
@ -99,6 +101,7 @@ sub process_request {
|
||||
}
|
||||
}
|
||||
my $nrtab;
|
||||
my @discoverynics;
|
||||
if (defined($request->{arch})) {
|
||||
#Set the architecture in nodetype. If 32-bit only x86 or ppc detected, overwrite. If x86_64, only set if either not set or not an x86 family
|
||||
my $typetab=xCAT::Table->new("nodetype",-create=>1);
|
||||
@ -119,7 +122,10 @@ sub process_request {
|
||||
}
|
||||
my $currboot='';
|
||||
$nrtab = xCAT::Table->new('noderes'); #Attempt to check and set if wrong the netboot method on discovery, if admin omitted
|
||||
(my $rent) = $nrtab->getNodeAttribs($node,['netboot']);
|
||||
(my $rent) = $nrtab->getNodeAttribs($node,['netboot','discoverynics']);
|
||||
if ($rent and defined $rent->{discoverynics}) {
|
||||
@discoverynics=split /,/,$rent->{discoverynics};
|
||||
}
|
||||
if ($rent and $rent->{'netboot'}) {
|
||||
$currboot=$rent->{'netboot'};
|
||||
}
|
||||
@ -134,31 +140,58 @@ sub process_request {
|
||||
my @ifinfo;
|
||||
my $macstring = "";
|
||||
my %usednames;
|
||||
my %bydriverindex;
|
||||
my $forcenic=0; #-1 is force skip, 0 is use default behavior, 1 is force to be declared even if hosttag is skipped to do so
|
||||
foreach (@{$request->{mac}}) {
|
||||
@ifinfo = split /\|/;
|
||||
if ($ifinfo[3]) {
|
||||
(my $ip,my $netbits) = split /\//,$ifinfo[3];
|
||||
if ($ip =~ /\d+\.\d+\.\d+\.\d+/) {
|
||||
my $ipn = unpack("N",inet_aton($ip));
|
||||
my $mask = 2**$netbits-1<<(32-$netbits);
|
||||
my $netn = inet_ntoa(pack("N",$ipn & $mask));
|
||||
my $hosttag = gethosttag($node,$netn,@ifinfo[1],\%usednames);
|
||||
if ($hosttag) {
|
||||
(my $rent) = $nrtab->getNodeAttribs($node,['primarynic','nfsserver']);
|
||||
unless ($rent and $rent->{primarynic}) { #if primarynic not set, set it to this nic
|
||||
$nrtab->setNodeAttribs($node,{primarynic=>@ifinfo[1]});
|
||||
}
|
||||
unless ($rent and $rent->{nfsserver}) {
|
||||
$nrtab->setNodeAttribs($node,{nfsserver=>xCAT::Utils->my_ip_facing($hosttag)});
|
||||
}
|
||||
$usednames{$hosttag}=1;
|
||||
$macstring .= $ifinfo[2]."!".$hosttag."|";
|
||||
} else {
|
||||
$macstring .= $ifinfo[2]."!*NOIP*|";
|
||||
@ifinfo = split /\|/;
|
||||
$bydriverindex{$ifinfo[0]} += 1;
|
||||
if (scalar @discoverynics) {
|
||||
$forcenic=-1; #$forcenic defaults to explicitly skip nic
|
||||
foreach my $nic (@discoverynics) {
|
||||
if ($nic =~ /:/) { #syntax like 'bnx2:0' to say the first bnx2 managed interface
|
||||
(my $driver,my $index) = split /:/,$nic;
|
||||
if ($driver eq $ifinfo[0] and $index == ($bydriverindex{$driver}-1)) {
|
||||
$forcenic=1; #force nic to be put into database
|
||||
last;
|
||||
}
|
||||
} else { #simple 'eth2' sort of argument
|
||||
if ($nic eq $ifinfo[1]) {
|
||||
$forcenic=1;
|
||||
last;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($forcenic == -1) { #if force to skip, go to next nic
|
||||
next;
|
||||
}
|
||||
if ($ifinfo[3]) {
|
||||
(my $ip,my $netbits) = split /\//,$ifinfo[3];
|
||||
if ($ip =~ /\d+\.\d+\.\d+\.\d+/) {
|
||||
my $ipn = unpack("N",inet_aton($ip));
|
||||
my $mask = 2**$netbits-1<<(32-$netbits);
|
||||
my $netn = inet_ntoa(pack("N",$ipn & $mask));
|
||||
my $hosttag = gethosttag($node,$netn,@ifinfo[1],\%usednames);
|
||||
if ($hosttag) {
|
||||
(my $rent) = $nrtab->getNodeAttribs($node,['primarynic','nfsserver']);
|
||||
unless ($rent and $rent->{primarynic}) { #if primarynic not set, set it to this nic
|
||||
$nrtab->setNodeAttribs($node,{primarynic=>@ifinfo[1]});
|
||||
}
|
||||
unless ($rent and $rent->{nfsserver}) {
|
||||
$nrtab->setNodeAttribs($node,{nfsserver=>xCAT::Utils->my_ip_facing($hosttag)});
|
||||
}
|
||||
$usednames{$hosttag}=1;
|
||||
$macstring .= $ifinfo[2]."!".$hosttag."|";
|
||||
} else {
|
||||
if ($forcenic == 1) { $macstring .= $ifinfo[2]."|"; } else { $macstring .= $ifinfo[2]."!*NOIP*|"; }
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ($forcenic == 1) { $macstring .= $ifinfo[2]."|"; }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$macstring =~ s/\|\z//;
|
||||
$mactab->setNodeAttribs($node,{mac=>$macstring});
|
||||
my %request = (
|
||||
command => ['makedhcp'],
|
||||
|
Loading…
Reference in New Issue
Block a user