Don't try to do the flush/unflush in the main loop or the timer will kill it

This commit is contained in:
Joshua Boniface 2018-06-11 22:45:06 -04:00
parent 8559e429ce
commit f3153a15b3
1 changed files with 8 additions and 8 deletions

View File

@ -57,7 +57,14 @@ class NodeInstance():
try: try:
self.domain_state = data.decode('ascii') self.domain_state = data.decode('ascii')
except AttributeError: except AttributeError:
self.domain_state = 'stop' self.domain_state = 'unknown'
# toggle state management of this node
if self.domain_state == 'flush' and self.inflush == False:
self.flush()
if self.domain_state == 'unflush' and self.inflush == False:
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=""):
@ -304,10 +311,3 @@ class NodeInstance():
ansiiprint.echo('{}Active nodes:{} {}'.format(ansiiprint.bold(), ansiiprint.end(), ' '.join(self.active_node_list)), '', 'c') ansiiprint.echo('{}Active nodes:{} {}'.format(ansiiprint.bold(), ansiiprint.end(), ' '.join(self.active_node_list)), '', 'c')
ansiiprint.echo('{}Inactive nodes:{} {}'.format(ansiiprint.bold(), ansiiprint.end(), ' '.join(self.inactive_node_list)), '', 'c') ansiiprint.echo('{}Inactive nodes:{} {}'.format(ansiiprint.bold(), ansiiprint.end(), ' '.join(self.inactive_node_list)), '', 'c')
ansiiprint.echo('{}Flushed nodes:{} {}'.format(ansiiprint.bold(), ansiiprint.end(), ' '.join(self.flushed_node_list)), '', 'c') ansiiprint.echo('{}Flushed nodes:{} {}'.format(ansiiprint.bold(), ansiiprint.end(), ' '.join(self.flushed_node_list)), '', 'c')
# toggle state management of this node
if self.domain_state == 'flush' and self.inflush == False:
self.flush()
if self.domain_state == 'unflush' and self.inflush == False:
self.unflush()