From c44732be83fca5f56ae84d2faad704572b4e0be9 Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Sat, 9 Oct 2021 19:13:17 -0400 Subject: [PATCH] Avoid duplicate runs of MTU set It wasn't the validator duplicating, but the update duplicating, so avoid that happening properly this time. --- node-daemon/pvcnoded/objects/VXNetworkInstance.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/node-daemon/pvcnoded/objects/VXNetworkInstance.py b/node-daemon/pvcnoded/objects/VXNetworkInstance.py index 58af404c..d722dd79 100644 --- a/node-daemon/pvcnoded/objects/VXNetworkInstance.py +++ b/node-daemon/pvcnoded/objects/VXNetworkInstance.py @@ -83,8 +83,6 @@ class VXNetworkInstance(object): except Exception: self.vx_mtu = None - self.validateNetworkMTU() - # Zookeper handlers for changed states @self.zkhandler.zk_conn.DataWatch(self.zkhandler.schema.path('network', self.vni)) def watch_network_description(data, stat, event=''): @@ -106,12 +104,13 @@ class VXNetworkInstance(object): # because this class instance is about to be reaped in Daemon.py return False - if data and self.vx_mtu != data.decode('ascii'): + if data and str(self.vx_mtu) != data.decode('ascii'): self.vx_mtu = data.decode('ascii') self.validateNetworkMTU() self.updateNetworkMTU() except Exception: - pass + self.validateNetworkMTU() + self.updateNetworkMTU() self.createNetworkBridged() @@ -137,8 +136,6 @@ class VXNetworkInstance(object): except Exception: self.vx_mtu = None - self.validateNetworkMTU() - self.nftables_netconf_filename = '{}/networks/{}.nft'.format(self.config['nft_dynamic_directory'], self.vni) self.firewall_rules = [] @@ -252,12 +249,13 @@ add rule inet filter forward ip6 saddr {netaddr6} counter jump {vxlannic}-out # because this class instance is about to be reaped in Daemon.py return False - if data and self.vx_mtu != data.decode('ascii'): + if data and str(self.vx_mtu) != data.decode('ascii'): self.vx_mtu = data.decode('ascii') self.validateNetworkMTU() self.updateNetworkMTU() except Exception: - pass + self.validateNetworkMTU() + self.updateNetworkMTU() @self.zkhandler.zk_conn.DataWatch(self.zkhandler.schema.path('network.ip6.network', self.vni)) def watch_network_ip6_network(data, stat, event=''):