From 8c66cc700a53b75d670ff54b209d095a8d99eacb Mon Sep 17 00:00:00 2001 From: jbjohnso Date: Thu, 15 May 2008 17:45:47 +0000 Subject: [PATCH] -Really really ignore 169.254 network -Attempt to restart dhcp on certain conditions. Not fully catching, but makedhcp -n implies reset service. -chkconfig dhcpd on if asked to do dhcp git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@1414 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server-2.0/lib/xcat/plugins/dhcp.pm | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/xCAT-server-2.0/lib/xcat/plugins/dhcp.pm b/xCAT-server-2.0/lib/xcat/plugins/dhcp.pm index 5281954eb..90b252f77 100644 --- a/xCAT-server-2.0/lib/xcat/plugins/dhcp.pm +++ b/xCAT-server-2.0/lib/xcat/plugins/dhcp.pm @@ -17,6 +17,7 @@ my $domain; my $omshell; my $statements; #Hold custom statements to be slipped into host declarations my $callback; +my $restartdhcp; sub handled_commands { @@ -291,6 +292,7 @@ sub preprocess_request sub process_request { + $restartdhcp=0; my $req = shift; $callback = shift; my $sitetab = xCAT::Table->new('site'); @@ -362,6 +364,7 @@ sub process_request } unless ($dhcpconf[0] =~ /^#xCAT/) { #Discard file if not xCAT originated, like 1.x did + $restartdhcp=1; @dhcpconf = (); } } @@ -384,6 +387,7 @@ sub process_request } unless ($dhcpconf[0]) { #populate an empty config with some starter data... + $restartdhcp=1; newconfig(); } foreach (keys %activenics) @@ -465,6 +469,10 @@ sub process_request } } writeout(); + if ($restartdhcp) { + system("/etc/init.d/dhcpd restart"); + system("chkconfig dhcpd on"); + } } sub addnet @@ -472,8 +480,12 @@ sub addnet my $net = shift; my $mask = shift; my $nic; + if ($net eq "169.254.0.0") { + return; + } unless (grep /\} # $net\/$mask subnet_end/, @dhcpconf) { + $restartdhcp=1; foreach (@nrn) { # search for relevant NIC my @ent = split /\s+/; @@ -633,6 +645,7 @@ sub addnic my $lastindex = 0; unless (grep /} # $nic nic_end/, @dhcpconf) { #add a section if not there + $restartdhcp=1; print "Adding NIC $nic\n"; push @dhcpconf, "shared-network $nic {\n"; push @dhcpconf, "\} # $nic nic_end\n";