Rewrite DNSAggregatorInstance to handle DNS well
Trying to directly AXFR from dnsmasq is a mess, since their zone is barely compliant with spec, it doesn't support notifies, and it is generally really messy. This implements an advanced "AXFR parser" system, which looks at the results of an AXFR from the local dnsmasq instances per-network, and updates the real replicated MariaDB pdns backend cluster with the changed data. This allows a sensible, transferable zone with its own SOA that is dynamically reconfigured as hosts come and go from the dnsmasq zone.
This commit is contained in:
@ -245,30 +245,22 @@ class NodeInstance(object):
|
||||
self.logger.out('Setting router {} to secondary state'.format(self.name), state='i')
|
||||
self.logger.out('Network list: {}'.format(', '.join(self.network_list)))
|
||||
time.sleep(1)
|
||||
self.dns_aggregator.stop_aggregator()
|
||||
for network in self.d_network:
|
||||
self.d_network[network].stopDHCPServer()
|
||||
self.d_network[network].removeGateway4Address()
|
||||
self.d_network[network].removeGateway6Address()
|
||||
self.dns_aggregator.remove_client_network(network)
|
||||
self.dns_aggregator.stop_aggregator()
|
||||
self.d_network[network].removeGateways()
|
||||
self.removeFloatingAddresses()
|
||||
|
||||
def become_primary(self):
|
||||
self.logger.out('Setting router {} to primary state.'.format(self.name), state='i')
|
||||
self.logger.out('Network list: {}'.format(', '.join(self.network_list)))
|
||||
self.createFloatingAddresses()
|
||||
self.dns_aggregator.start_aggregator()
|
||||
time.sleep(0.5)
|
||||
# Start up the gateways and DHCP servers
|
||||
for network in self.d_network:
|
||||
self.dns_aggregator.add_client_network(network)
|
||||
self.d_network[network].createGateway4Address()
|
||||
self.d_network[network].createGateway6Address()
|
||||
self.d_network[network].createGateways()
|
||||
self.d_network[network].startDHCPServer()
|
||||
time.sleep(0.5)
|
||||
# Handle AXFRs after to avoid slowdowns
|
||||
for network in self.d_network:
|
||||
self.dns_aggregator.get_axfr(network)
|
||||
self.dns_aggregator.start_aggregator()
|
||||
|
||||
def createFloatingAddresses(self):
|
||||
# VNI floating IP
|
||||
|
Reference in New Issue
Block a user