Tweaks to startup and shutdown
This commit is contained in:
parent
4612c8086f
commit
a5257e75b0
|
@ -243,12 +243,16 @@ def updatenetworks(new_network_list):
|
||||||
for network in new_network_list:
|
for network in new_network_list:
|
||||||
if not network in s_network:
|
if not network in s_network:
|
||||||
s_network[network] = VXNetworkInstance.VXNetworkInstance(network, zk_conn, config, t_router[myhostname])
|
s_network[network] = VXNetworkInstance.VXNetworkInstance(network, zk_conn, config, t_router[myhostname])
|
||||||
|
if this_router.network_state == 'primary':
|
||||||
|
s_network[network].createGatewayAddress()
|
||||||
|
s_network[network].startDHCPServer()
|
||||||
for network in network_list:
|
for network in network_list:
|
||||||
if not network in new_network_list:
|
if not network in new_network_list:
|
||||||
if this_router.network_state == 'primary':
|
if this_router.network_state == 'primary':
|
||||||
s_network[network].stopDHCPServer()
|
s_network[network].stopDHCPServer()
|
||||||
s_network[network].removeGatewayAddress()
|
s_network[network].removeGatewayAddress()
|
||||||
s_network[network].removeNetwork()
|
s_network[network].removeNetwork()
|
||||||
|
del(s_network[network])
|
||||||
network_list = new_network_list
|
network_list = new_network_list
|
||||||
for router in router_list:
|
for router in router_list:
|
||||||
if router in t_router:
|
if router in t_router:
|
||||||
|
|
|
@ -155,6 +155,12 @@ class RouterInstance():
|
||||||
else:
|
else:
|
||||||
self.daemon_state = 'run'
|
self.daemon_state = 'run'
|
||||||
|
|
||||||
|
# Ensure the master key is properly set at a keepalive
|
||||||
|
if self.name == self.this_router:
|
||||||
|
if self.network_state == 'primary':
|
||||||
|
if zkhandler.readdata(self.zk_conn, '/routers') == 'none':
|
||||||
|
zkhandler.writedata(self.zk_conn, {'/routers': self.name})
|
||||||
|
|
||||||
# Set our information in zookeeper
|
# Set our information in zookeeper
|
||||||
cpuload = os.getloadavg()[0]
|
cpuload = os.getloadavg()[0]
|
||||||
keepalive_time = int(time.time())
|
keepalive_time = int(time.time())
|
||||||
|
|
|
@ -40,10 +40,10 @@ class VXNetworkInstance():
|
||||||
self.old_description = None
|
self.old_description = None
|
||||||
self.description = None
|
self.description = None
|
||||||
self.domain = None
|
self.domain = None
|
||||||
self.ip_gateway = None
|
self.ip_gateway = zkhandler.readdata(self.zk_conn, '/networks/{}/ip_gateway'.format(self.vni))
|
||||||
self.ip_network = None
|
self.ip_network = None
|
||||||
self.ip_cidrnetmask = None
|
self.ip_cidrnetmask = None
|
||||||
self.dhcp_flag = None
|
self.dhcp_flag = zkhandler.readdata(self.zk_conn, '/networks/{}/dhcp_flag'.format(self.vni))
|
||||||
self.dhcp_start = None
|
self.dhcp_start = None
|
||||||
self.dhcp_end = None
|
self.dhcp_end = None
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue