From 38d396f2a6d9af7726763328ee174a2d8c3c6ae2 Mon Sep 17 00:00:00 2001 From: jbjohnso Date: Mon, 5 Apr 2010 19:39:51 +0000 Subject: [PATCH] -Throttle number of records to update per payload to avoid format errors git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@5672 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/xcat/plugins/dns.pm | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/dns.pm b/xCAT-server/lib/xcat/plugins/dns.pm index b9e19cf42..6f828d740 100644 --- a/xCAT-server/lib/xcat/plugins/dns.pm +++ b/xCAT-server/lib/xcat/plugins/dns.pm @@ -528,12 +528,25 @@ sub add_records { foreach $zone (keys %{$ctx->{updatesbyzone}}) { my $resolver = Net::DNS::Resolver->new(nameservers=>[$ctx->{nsmap}->{$zone}]); my $entry; + my $numreqs = 300; # limit to 300 updates in a payload, something broke at 644 on a certain sample, choosing 300 for now my $update = Net::DNS::Update->new($zone); foreach $entry (@{$ctx->{updatesbyzone}->{$zone}}) { $update->push(update=>rr_add($entry)); + $numreqs -= 1; + if ($numreqs == 0) { + $update->sign_tsig("xcat_key",$ctx->{privkey}); + $numreqs=300; + my $reply = $resolver->send($update); + if ($reply->header->rcode ne 'NOERROR') { + sendmsg([1,"Failure encountered updating $zone, error was ".$reply->header->rcode]); + } + $update = Net::DNS::Update->new($zone); #new empty request + } + } + if ($numreqs == 300) { #either no entries at all to begin with or a perfect multiple of 300 + $update->sign_tsig("xcat_key",$ctx->{privkey}); + my $reply = $resolver->send($update); } - $update->sign_tsig("xcat_key",$ctx->{privkey}); - my $reply = $resolver->send($update); } } sub find_nameserver_for_dns {