From 0e74e0df3ae0823585136f9730ca1658222a14dc Mon Sep 17 00:00:00 2001 From: jbjohnso Date: Thu, 13 Mar 2008 21:32:00 +0000 Subject: [PATCH] -Fix bug where next-server guessing wasn't attempted in absence of a noderes table -Fix bug where nex-server guessing wasn't performing per hostname on multi-homed nodes git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@779 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server-2.0/lib/xcat/plugins/dhcp.pm | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/xCAT-server-2.0/lib/xcat/plugins/dhcp.pm b/xCAT-server-2.0/lib/xcat/plugins/dhcp.pm index d19a2f354..6576a8d61 100644 --- a/xCAT-server-2.0/lib/xcat/plugins/dhcp.pm +++ b/xCAT-server-2.0/lib/xcat/plugins/dhcp.pm @@ -84,16 +84,14 @@ sub addnode { my $ent; my $nrtab = xCAT::Table->new('noderes'); my $lstatements = $statements; + my $guess_next_server=0; if ($nrtab) { my $ent; $ent = $nrtab->getNodeAttribs($node,['tftpserver']); if ($ent and $ent->{tftpserver}) { $lstatements = 'next-server '.inet_ntoa(inet_aton($ent->{tftpserver})).';'.$statements; } else { - my $nxtsrv = xCAT::Utils->my_ip_facing($node); - if ($nxtsrv) { - $lstatements = "next-server $nxtsrv;$statements"; - } + $guess_next_server=1; } #else { # $ent = $nrtab->getNodeAttribs($node,['servicenode']); @@ -101,6 +99,8 @@ sub addnode { # $statements = 'next-server = \"'.inet_ntoa(inet_aton($ent->{servicenode})).'\";'.$statements; # } #} + } else { + $guess_next_server=1; } my $mactab = xCAT::Table->new('mac'); unless ($mactab) { @@ -126,6 +126,12 @@ sub addnode { return; } my $ip = inet_ntoa(inet_aton($hname));; + if ($guess_next_server) { + my $nxtsrv = xCAT::Utils->my_ip_facing($hname); + if ($nxtsrv) { + $lstatements = "next-server $nxtsrv;$statements"; + } + } syslog("local4|err","Setting $node ($hname|$ip) to ".$mac); print $omshell "new host\n"; print $omshell "set name = \"$hname\"\n"; #Find and destroy conflict name