Avoid duplicate runs of MTU set

It wasn't the validator duplicating, but the update duplicating, so
avoid that happening properly this time.
This commit is contained in:
Joshua Boniface 2021-10-09 19:13:17 -04:00
parent a8b68e0968
commit c44732be83
1 changed files with 6 additions and 8 deletions

View File

@ -83,8 +83,6 @@ class VXNetworkInstance(object):
except Exception: except Exception:
self.vx_mtu = None self.vx_mtu = None
self.validateNetworkMTU()
# Zookeper handlers for changed states # Zookeper handlers for changed states
@self.zkhandler.zk_conn.DataWatch(self.zkhandler.schema.path('network', self.vni)) @self.zkhandler.zk_conn.DataWatch(self.zkhandler.schema.path('network', self.vni))
def watch_network_description(data, stat, event=''): 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 # because this class instance is about to be reaped in Daemon.py
return False 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.vx_mtu = data.decode('ascii')
self.validateNetworkMTU() self.validateNetworkMTU()
self.updateNetworkMTU() self.updateNetworkMTU()
except Exception: except Exception:
pass self.validateNetworkMTU()
self.updateNetworkMTU()
self.createNetworkBridged() self.createNetworkBridged()
@ -137,8 +136,6 @@ class VXNetworkInstance(object):
except Exception: except Exception:
self.vx_mtu = None self.vx_mtu = None
self.validateNetworkMTU()
self.nftables_netconf_filename = '{}/networks/{}.nft'.format(self.config['nft_dynamic_directory'], self.vni) self.nftables_netconf_filename = '{}/networks/{}.nft'.format(self.config['nft_dynamic_directory'], self.vni)
self.firewall_rules = [] 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 # because this class instance is about to be reaped in Daemon.py
return False 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.vx_mtu = data.decode('ascii')
self.validateNetworkMTU() self.validateNetworkMTU()
self.updateNetworkMTU() self.updateNetworkMTU()
except Exception: except Exception:
pass self.validateNetworkMTU()
self.updateNetworkMTU()
@self.zkhandler.zk_conn.DataWatch(self.zkhandler.schema.path('network.ip6.network', self.vni)) @self.zkhandler.zk_conn.DataWatch(self.zkhandler.schema.path('network.ip6.network', self.vni))
def watch_network_ip6_network(data, stat, event=''): def watch_network_ip6_network(data, stat, event=''):