From 78f053d81f03a960242c05b9cd82b21a503619f0 Mon Sep 17 00:00:00 2001 From: Joshua Boniface Date: Fri, 13 Dec 2019 00:00:37 -0500 Subject: [PATCH] Recreate network in aggregator if DNS changes --- node-daemon/pvcd/Daemon.py | 2 +- node-daemon/pvcd/VXNetworkInstance.py | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/node-daemon/pvcd/Daemon.py b/node-daemon/pvcd/Daemon.py index 9b748dfb..8233ee68 100644 --- a/node-daemon/pvcd/Daemon.py +++ b/node-daemon/pvcd/Daemon.py @@ -796,7 +796,7 @@ if enable_networking: # Add any missing networks to the list for network in new_network_list: if not network in network_list: - d_network[network] = VXNetworkInstance.VXNetworkInstance(network, zk_conn, config, logger, this_node) + d_network[network] = VXNetworkInstance.VXNetworkInstance(network, zk_conn, config, logger, this_node, dns_aggregator) if config['daemon_mode'] == 'coordinator' and d_network[network].nettype == 'managed': try: dns_aggregator.add_network(d_network[network]) diff --git a/node-daemon/pvcd/VXNetworkInstance.py b/node-daemon/pvcd/VXNetworkInstance.py index f07af610..678e582c 100644 --- a/node-daemon/pvcd/VXNetworkInstance.py +++ b/node-daemon/pvcd/VXNetworkInstance.py @@ -31,12 +31,13 @@ import pvcd.common as common class VXNetworkInstance(object): # Initialization function - def __init__ (self, vni, zk_conn, config, logger, this_node): + def __init__ (self, vni, zk_conn, config, logger, this_node, dns_aggregator): self.vni = vni self.zk_conn = zk_conn self.config = config self.logger = logger self.this_node = this_node + self.dns_aggregator = dns_aggregator self.vni_dev = config['vni_dev'] self.vni_mtu = config['vni_mtu'] @@ -184,8 +185,11 @@ add rule inet filter forward ip6 saddr {netaddr6} counter jump {vxlannic}-out if data and self.domain != data.decode('ascii'): domain = data.decode('ascii') + if self.dhcp_server_daemon: + self.dns_aggregator.remove_network(self) self.domain = domain if self.dhcp_server_daemon: + self.dns_aggregator.add_network(self) self.stopDHCPServer() self.startDHCPServer() @@ -198,8 +202,11 @@ add rule inet filter forward ip6 saddr {netaddr6} counter jump {vxlannic}-out if data and self.name_servers != data.decode('ascii'): name_servers = data.decode('ascii').split(',') + if self.dhcp_server_daemon: + self.dns_aggregator.remove_network(self) self.name_servers = name_servers if self.dhcp_server_daemon: + self.dns_aggregator.add_network(self) self.stopDHCPServer() self.startDHCPServer()