Fix up some more bugs
This commit is contained in:
parent
ae445d7770
commit
7bcb2e0b00
|
@ -77,11 +77,16 @@ class NodeInstance(threading.Thread):
|
|||
while True:
|
||||
self.memfree = conn.getFreeMemory()
|
||||
self.cpuload = os.getloadavg()[0]
|
||||
try:
|
||||
self.zk.set(self.zkey + '/memfree', str(self.memfree).encode('ascii'))
|
||||
self.zk.set(self.zkey + '/cpuload', str(self.cpuload).encode('ascii'))
|
||||
except:
|
||||
if self.stop_thread.is_set():
|
||||
return
|
||||
|
||||
print("Free memory: %s | Load: %s" % ( self.memfree, self.cpuload ))
|
||||
print("Active domains: %s" % self.domainlist)
|
||||
for x in range(0,50):
|
||||
for x in range(0,100):
|
||||
time.sleep(0.1)
|
||||
if self.stop_thread.is_set():
|
||||
return
|
||||
|
|
11
pvcd.py
11
pvcd.py
|
@ -43,9 +43,11 @@ myhostname = socket.gethostname()
|
|||
mynodestring = '/nodes/%s' % myhostname
|
||||
|
||||
def cleanup():
|
||||
zk.set('%s/state' % mynodestring, 'stop'.encode('ascii'))
|
||||
for node in node_list:
|
||||
t_node[node].stop()
|
||||
t_node[myhostname].stop()
|
||||
try:
|
||||
zk.set('/nodes/' + myhostname + '/state', 'stop'.encode('ascii'))
|
||||
except:
|
||||
pass
|
||||
zk.stop()
|
||||
|
||||
atexit.register(cleanup)
|
||||
|
@ -76,9 +78,8 @@ def updatenodes(new_node_list):
|
|||
t_node[node].updatenodelist(node_list)
|
||||
else:
|
||||
t_node[node] = NodeInstance.NodeInstance(node, node_list, zk);
|
||||
if t_node[node].name == myhostname:
|
||||
if node == myhostname:
|
||||
t_node[node].start()
|
||||
time.sleep(1)
|
||||
|
||||
node_state = t_node[node].getstate()
|
||||
if node_state == 'start':
|
||||
|
|
Loading…
Reference in New Issue