-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
This commit is contained in:
jbjohnso 2010-04-05 19:39:51 +00:00
parent 74a89b1761
commit 38d396f2a6

View File

@ -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 {