Implement locking for unflush as well

References #32
This commit is contained in:
2019-05-11 00:13:03 -04:00
parent 9d8c886811
commit 62a71af46e
2 changed files with 37 additions and 1 deletions

View File

@ -364,6 +364,16 @@ class NodeInstance(object):
})
def unflush(self):
# Wait indefinitely for the flush_lock to be freed
time.sleep(0.5)
while zkhandler.readdata(self.zk_conn, '/locks/flush_lock') == 'True':
time.sleep(2)
# Acquire the flush lock
zkhandler.writedata(self.zk_conn, {
'/locks/flush_lock': 'True'
})
self.inflush = True
self.logger.out('Restoring node {} to active service.'.format(self.name), state='i')
zkhandler.writedata(self.zk_conn, { '/nodes/{}/domainstate'.format(self.name): 'ready' })
@ -386,6 +396,11 @@ class NodeInstance(object):
self.inflush = False
# Release the flush lock
zkhandler.writedata(self.zk_conn, {
'/locks/flush_lock': 'False'
})
#
# Find a migration target
#