From ba77d92c275b2afac26d64f12fd68fca2e7c244f Mon Sep 17 00:00:00 2001 From: jbjohnso Date: Fri, 19 Mar 2010 13:23:17 +0000 Subject: [PATCH] -Restore round-robin sourcing from /etc/hosts feature git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@5525 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/xcat/plugins/dns.pm | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/dns.pm b/xCAT-server/lib/xcat/plugins/dns.pm index f55ea67f7..ee58e6eca 100644 --- a/xCAT-server/lib/xcat/plugins/dns.pm +++ b/xCAT-server/lib/xcat/plugins/dns.pm @@ -134,6 +134,7 @@ sub process_request { $ctx->{aliases}->{$node}->{$alias}=1; #remember alias for CNAM records later } push @nodes,$node; + $ctx->{nodeips}->{$node}->{$addr}=1; } } my $hoststab = xCAT::Table->new('hosts',-create=>0); @@ -530,9 +531,14 @@ sub find_nameserver_for_dns { my $rname = $ctx->{currrevname}; my $name = $ctx->{currname}; unless ($name =~ /\.\z/) { $name .= '.' } - my $rrcontent = "$name IN A $ip"; + my @rrcontent = ( "$name IN A $ip" ); + foreach (keys %{$ctx->{nodeips}->{$node}}) { + unless ($_ eq $ip) { + push @rrcontent,"$name IN A $_"; + } + } if ($zone =~ /IN-ADDR.ARPA/) { #reverse style - $rrcontent = "$rname IN PTR $name"; + @rrcontent = ("$rname IN PTR $name"); } while ($zone) { unless (defined $ctx->{nsmap}->{$zone}) { #ok, we already thought about this zone and made a decision @@ -554,11 +560,7 @@ sub find_nameserver_for_dns { } } if ($ctx->{nsmap}->{$zone}) { #we have a nameserver for this zone, therefore this zone is one to update - if ($ctx->{updatesbyzone}->{$zone}) { #attach to existing list of updates - push @{$ctx->{updatesbyzone}->{$zone}},$rrcontent; - } else { #create a new list. - $ctx->{updatesbyzone}->{$zone} = [ $rrcontent ]; - } + push @{$ctx->{updatesbyzone}->{$zone}},@rrcontent; last; } else { #we have it defined, but zero, means search higher domains. Possible to shortcut further by pointing to the right domain, maybe later if ($zone !~ /\./) {