From aca218eae7b8bc61f3873f201f2e164b5509738f Mon Sep 17 00:00:00 2001 From: jbjohnso Date: Tue, 1 Jun 2010 20:40:23 +0000 Subject: [PATCH] -Have makedhcp work for floating ip behavior git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@6295 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/xcat/plugins/dhcp.pm | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/dhcp.pm b/xCAT-server/lib/xcat/plugins/dhcp.pm index b9c5a7058..338f85b44 100644 --- a/xCAT-server/lib/xcat/plugins/dhcp.pm +++ b/xCAT-server/lib/xcat/plugins/dhcp.pm @@ -10,6 +10,7 @@ Getopt::Long::Configure("pass_through"); use Socket; use Sys::Syslog; use IPC::Open2; +use xCAT::NetworkUtils; use xCAT::Utils; use xCAT::NodeRange; use Fcntl ':flock'; @@ -204,14 +205,12 @@ sub addnode } #Default to hostname equal to nodename unless ($mac) { next; } #Skip corrupt format my $ip = xCAT::Utils::getNodeIPaddress($hname); - if ( !defined($ip) ) { - $ip = "DENIED"; - } if ($hname eq '*NOIP*') { $hname = $node . "-noip".$mac; $hname =~ s/://g; + $ip='DENIED'; } - if ($guess_next_server and $ip ne "DENIED") + if ($guess_next_server and $ip and $ip ne "DENIED") { $nxtsrv = xCAT::Utils->my_ip_facing($hname); if ($nxtsrv) @@ -219,6 +218,8 @@ sub addnode $tftpserver = $nxtsrv; $lstatements = "next-server $nxtsrv;$statements"; } + } elsif ($guess_next_server) { + $nxtsrv='${next-server}'; #if floating IP support, cause gPXE command-line expansion patch to drive inheritence from network } my $doiscsi=0; if ($ient and $ient->{server} and $ient->{target}) { @@ -282,11 +283,13 @@ sub addnode print $omshell "open\n"; print $omshell "remove\n"; print $omshell "close\n"; - print $omshell "new host\n"; - print $omshell "set ip-address = $ip\n"; #find and destroy ip conflict - print $omshell "open\n"; - print $omshell "remove\n"; - print $omshell "close\n"; + if ($ip and $ip ne 'DENIED') { + print $omshell "new host\n"; + print $omshell "set ip-address = $ip\n"; #find and destroy ip conflict + print $omshell "open\n"; + print $omshell "remove\n"; + print $omshell "close\n"; + } print $omshell "new host\n"; print $omshell "set hardware-address = " . $mac . "\n"; #find and destroy mac conflict @@ -304,7 +307,9 @@ sub addnode } else { - print $omshell "set ip-address = $ip\n"; + if ($ip) { + print $omshell "set ip-address = $ip\n"; + } if ($lstatements) { $lstatements = 'ddns-hostname \"'.$node.'\"; send host-name \"'.$node.'\";'.$lstatements; @@ -789,7 +794,7 @@ sub process_request } else { - unless (xCAT::Utils->nodeonmynet($_)) + if (xCAT::NetworkUtils->getipaddr($_) and not xCAT::Utils->nodeonmynet($_)) { next; }