Numerous tweaks and bugfixes

This commit is contained in:
Joshua Boniface 2018-06-12 21:56:34 -04:00
parent 85c8ced3f9
commit 68f6316c8e
1 changed files with 7 additions and 7 deletions

View File

@ -137,7 +137,7 @@ class NodeInstance():
if hypervisor == current_hypervisor: if hypervisor == current_hypervisor:
continue continue
if daemon_state != 'start' or domain_state != 'ready': if daemon_state != 'run' or domain_state != 'ready':
continue continue
memfree = int(self.zk.get('/nodes/{}/memfree'.format(hypervisor))[0].decode('ascii')) memfree = int(self.zk.get('/nodes/{}/memfree'.format(hypervisor))[0].decode('ascii'))
@ -196,11 +196,11 @@ class NodeInstance():
# Get past state and update if needed # Get past state and update if needed
past_state = self.zk.get('/nodes/{}/daemonstate'.format(self.name))[0].decode('ascii') past_state = self.zk.get('/nodes/{}/daemonstate'.format(self.name))[0].decode('ascii')
if past_state != 'start': if past_state != 'run':
self.daemon_state = 'start' self.daemon_state = 'run'
self.zk.set('/nodes/{}/daemonstate'.format(self.name), 'run'.encode('ascii')) self.zk.set('/nodes/{}/daemonstate'.format(self.name), 'run'.encode('ascii'))
else: else:
self.daemon_state = 'start' self.daemon_state = 'run'
# Toggle state management of dead VMs to restart them # Toggle state management of dead VMs to restart them
for domain, instance in self.s_domain.items(): for domain, instance in self.s_domain.items():
@ -255,14 +255,14 @@ class NodeInstance():
# (A node is considered dead when its keepalive timer is >6*keepalive_interval seconds # (A node is considered dead when its keepalive timer is >6*keepalive_interval seconds
# out-of-date while in 'start' state) # out-of-date while in 'start' state)
node_deadtime = int(time.time()) - ( int(self.config['keepalive_interval']) * 6 ) node_deadtime = int(time.time()) - ( int(self.config['keepalive_interval']) * 6 )
if node_keepalive < node_deadtime and node_daemon_state == 'start': if node_keepalive < node_deadtime and node_daemon_state == 'run':
ansiiprint.echo('Node {} seems dead - starting monitor for fencing'.format(node_name), '', 'w') ansiiprint.echo('Node {} seems dead - starting monitor for fencing'.format(node_name), '', 'w')
self.zk.set('/nodes/{}/daemonstate'.format(node_name), 'dead'.encode('ascii')) self.zk.set('/nodes/{}/daemonstate'.format(node_name), 'dead'.encode('ascii'))
fence_thread = threading.Thread(target=fencenode.fence, args=(node_name, self.zk), kwargs={}) fence_thread = threading.Thread(target=fencenode.fence, args=(node_name, self.zk), kwargs={})
fence_thread.start() fence_thread.start()
# Update the arrays # Update the arrays
if node_daemon_state == 'start' and node_domain_state != 'flushed' and node_name not in self.active_node_list: if node_daemon_state == 'run' and node_domain_state != 'flushed' and node_name not in self.active_node_list:
self.active_node_list.append(node_name) self.active_node_list.append(node_name)
try: try:
self.flushed_node_list.remove(node_name) self.flushed_node_list.remove(node_name)
@ -272,7 +272,7 @@ class NodeInstance():
self.inactive_node_list.remove(node_name) self.inactive_node_list.remove(node_name)
except ValueError: except ValueError:
pass pass
if node_daemon_state != 'start' and node_daemon_state != 'flushed' and node_name not in self.inactive_node_list: if node_daemon_state != 'run' and node_domain_state != 'flushed' and node_name not in self.inactive_node_list:
self.inactive_node_list.append(node_name) self.inactive_node_list.append(node_name)
try: try:
self.active_node_list.remove(node_name) self.active_node_list.remove(node_name)