Move lock release to phase D

This commit is contained in:
Joshua Boniface 2020-10-21 11:02:02 -04:00
parent 82b4d3ed1b
commit 017953c2e6
1 changed files with 6 additions and 5 deletions

View File

@ -503,11 +503,6 @@ class VMInstance(object):
if do_migrate_shutdown:
migrate_shutdown_result = migrate_shutdown()
self.last_currentnode = zkhandler.readdata(self.zk_conn, '/domains/{}/node'.format(self.domuuid))
self.last_lastnode = zkhandler.readdata(self.zk_conn, '/domains/{}/lastnode'.format(self.domuuid))
migrate_lock_state.release()
self.logger.out('Releasing write lock for synchronization phase C', state='i', prefix='Domain {}'.format(self.domuuid))
lock.release()
self.logger.out('Released write lock for synchronization phase C', state='o', prefix='Domain {}'.format(self.domuuid))
@ -517,6 +512,10 @@ class VMInstance(object):
self.logger.out('Acquiring read lock for synchronization phase D', state='i', prefix='Domain {}'.format(self.domuuid))
lock.acquire()
self.logger.out('Acquired read lock for synchronization phase D', state='o', prefix='Domain {}'.format(self.domuuid))
self.last_currentnode = zkhandler.readdata(self.zk_conn, '/domains/{}/node'.format(self.domuuid))
self.last_lastnode = zkhandler.readdata(self.zk_conn, '/domains/{}/lastnode'.format(self.domuuid))
self.logger.out('Releasing read lock for synchronization phase D', state='i', prefix='Domain {}'.format(self.domuuid))
lock.release()
self.logger.out('Released read lock for synchronization phase D', state='o', prefix='Domain {}'.format(self.domuuid))
@ -524,6 +523,8 @@ class VMInstance(object):
# Wait 0.5 seconds for everything to stabilize before we declare all-done
time.sleep(0.5)
migrate_lock_node.release()
migrate_lock_state.release()
self.inmigrate = False
return