Improve some timeouts and conditionals

This commit is contained in:
Joshua Boniface 2020-10-21 11:58:01 -04:00
parent d42bb74dc9
commit 28abb018e3
1 changed files with 13 additions and 13 deletions

View File

@ -520,8 +520,8 @@ class VMInstance(object):
lock.release() lock.release()
self.logger.out('Released read lock for synchronization phase D', state='o', prefix='Domain {}'.format(self.domuuid)) self.logger.out('Released read lock for synchronization phase D', state='o', prefix='Domain {}'.format(self.domuuid))
# Wait 0.5 seconds for everything to stabilize before we declare all-done # Wait 1 second for everything to stabilize before we declare all-done and release locks
time.sleep(0.5) time.sleep(1)
migrate_lock_node.release() migrate_lock_node.release()
migrate_lock_state.release() migrate_lock_state.release()
@ -596,6 +596,7 @@ class VMInstance(object):
# The receive somehow failed # The receive somehow failed
zkhandler.writedata(self.zk_conn, { '/domains/{}/state'.format(self.domuuid): 'fail' }) zkhandler.writedata(self.zk_conn, { '/domains/{}/state'.format(self.domuuid): 'fail' })
else: else:
if self.node == self.this_node.name:
if self.state in ['start']: if self.state in ['start']:
# The receive was aborted # The receive was aborted
self.logger.out('Receive aborted via state change', state='w', prefix='Domain {}'.format(self.domuuid)) self.logger.out('Receive aborted via state change', state='w', prefix='Domain {}'.format(self.domuuid))
@ -607,10 +608,9 @@ class VMInstance(object):
self.logger.out('Migrate aborted or failed; VM in state {}'.format(self.state), state='w', prefix='Domain {}'.format(self.domuuid)) self.logger.out('Migrate aborted or failed; VM in state {}'.format(self.state), state='w', prefix='Domain {}'.format(self.domuuid))
self.logger.out('Releasing write lock for synchronization phase D', state='i', prefix='Domain {}'.format(self.domuuid)) self.logger.out('Releasing write lock for synchronization phase D', state='i', prefix='Domain {}'.format(self.domuuid))
zkhandler.writedata(self.zk_conn, { '/locks/domain_migrate/{}'.format(self.domuuid): '' })
lock.release() lock.release()
self.logger.out('Released write lock for synchronization phase D', state='o', prefix='Domain {}'.format(self.domuuid)) self.logger.out('Released write lock for synchronization phase D', state='o', prefix='Domain {}'.format(self.domuuid))
time.sleep(0.1) # Time for new writer to acquire the lock zkhandler.writedata(self.zk_conn, { '/locks/domain_migrate/{}'.format(self.domuuid): '' })
self.inreceive = False self.inreceive = False
return return