Avoid accidental flushing of not-this-host instances
This commit is contained in:
parent
8447c6890b
commit
77df48060a
|
@ -24,10 +24,11 @@ import os, sys, psutil, socket, time, libvirt, kazoo.client, threading, fencenod
|
||||||
|
|
||||||
class NodeInstance():
|
class NodeInstance():
|
||||||
# Initialization function
|
# Initialization function
|
||||||
def __init__(self, name, t_node, s_domain, zk, config):
|
def __init__(self, this_node, name, t_node, s_domain, zk, config):
|
||||||
# Passed-in variables on creation
|
# Passed-in variables on creation
|
||||||
self.zk = zk
|
self.zk = zk
|
||||||
self.config = config
|
self.config = config
|
||||||
|
self.this_node = this_node
|
||||||
self.name = name
|
self.name = name
|
||||||
self.state = 'stop'
|
self.state = 'stop'
|
||||||
self.t_node = t_node
|
self.t_node = t_node
|
||||||
|
@ -49,10 +50,11 @@ class NodeInstance():
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
self.state = 'stop'
|
self.state = 'stop'
|
||||||
|
|
||||||
if self.state == 'flush':
|
if self.name = self.this_node:
|
||||||
self.flush()
|
if self.state == 'flush':
|
||||||
if self.state == 'unflush':
|
self.flush()
|
||||||
self.unflush()
|
if self.state == 'unflush':
|
||||||
|
self.unflush()
|
||||||
|
|
||||||
@zk.DataWatch('/nodes/{}/memfree'.format(self.name))
|
@zk.DataWatch('/nodes/{}/memfree'.format(self.name))
|
||||||
def watch_hypervisor_memfree(data, stat, event=""):
|
def watch_hypervisor_memfree(data, stat, event=""):
|
||||||
|
|
2
pvcd.py
2
pvcd.py
|
@ -161,7 +161,7 @@ def updatenodes(new_node_list):
|
||||||
if node in t_node:
|
if node in t_node:
|
||||||
t_node[node].updatenodelist(t_node)
|
t_node[node].updatenodelist(t_node)
|
||||||
else:
|
else:
|
||||||
t_node[node] = NodeInstance.NodeInstance(node, t_node, s_domain, zk, config)
|
t_node[node] = NodeInstance.NodeInstance(myhostname, node, t_node, s_domain, zk, config)
|
||||||
|
|
||||||
@zk.ChildrenWatch('/domains')
|
@zk.ChildrenWatch('/domains')
|
||||||
def updatedomains(new_domain_list):
|
def updatedomains(new_domain_list):
|
||||||
|
|
Loading…
Reference in New Issue