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,21 +596,21 @@ 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.state in ['start']: if self.node == self.this_node.name:
# The receive was aborted if self.state in ['start']:
self.logger.out('Receive aborted via state change', state='w', prefix='Domain {}'.format(self.domuuid)) # The receive was aborted
elif self.state in ['stop']: self.logger.out('Receive aborted via state change', state='w', prefix='Domain {}'.format(self.domuuid))
# The send was shutdown-based elif self.state in ['stop']:
zkhandler.writedata(self.zk_conn, { '/domains/{}/state'.format(self.domuuid): 'start' }) # The send was shutdown-based
else: zkhandler.writedata(self.zk_conn, { '/domains/{}/state'.format(self.domuuid): 'start' })
# The send failed or was aborted else:
self.logger.out('Migrate aborted or failed; VM in state {}'.format(self.state), state='w', prefix='Domain {}'.format(self.domuuid)) # The send failed or was aborted
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