From 5a186691087798b4402ad3ee3fc0dc3c3867c10d Mon Sep 17 00:00:00 2001 From: sjing Date: Sat, 8 Jun 2013 07:04:09 +0000 Subject: [PATCH] bug 3478 - exclude the net with external namesserver configured from dns zones. git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@16580 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/xcat/plugins/ddns.pm | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/ddns.pm b/xCAT-server/lib/xcat/plugins/ddns.pm index ee1db7ae1..ab877a813 100644 --- a/xCAT-server/lib/xcat/plugins/ddns.pm +++ b/xCAT-server/lib/xcat/plugins/ddns.pm @@ -283,11 +283,30 @@ sub process_request { xCAT::SvrUtils::sendmsg([0,"Warning:SELINUX is not disabled. The makedns command will not be able to generate a complete DNS setup. Disable SELINUX and run the command again."], $callback); } + my @entries = xCAT::TableUtils->get_site_attribute("nameservers"); + my $sitens = $entries[0]; + unless ( defined($site_entry)) { + xCAT::SvrUtils::sendmsg([1,"nameservers not defined in site table"], $callback); + umask($oldmask); + return; + } my $networkstab = xCAT::Table->new('networks',-create=>0); unless ($networkstab) { xCAT::SvrUtils::sendmsg([1,'Unable to enumerate networks, try to run makenetworks'], $callback); } - my @networks = $networkstab->getAllAttribs('net','mask','ddnsdomain','domain','nameservers'); + my @networks = $networkstab->getAllAttribs('net','mask','ddnsdomain','domain','nameservers'); + # exclude the net if it is using an external dns server. + foreach (@networks) + { + if ($_ and $_->{nameservers}) + { + my $myip = xCAT::NetworkUtils->my_ip_facing($_->{net}); + unless (($_->{nameservers} eq $myip) || ($_->{nameservers} eq '') || ($_->{nameservers} eq $sitens)) + { + $_ = undef; + } + } + } # if ($request->{node}) { #we have a noderange to process # @nodes = @{$request->{node}}; @@ -413,7 +432,7 @@ sub process_request { { unless ($node =~ /localhost/) { - xCAT::SvrUtils::sendmsg(":Ignoring host $node in /etc/hosts, it does not belong to any nets defined in networks table.", $callback); + xCAT::SvrUtils::sendmsg(":Ignoring host $node, it does not belong to any nets defined in networks table or the net it belongs to is configured to use an external nameserver.", $callback); } } }