From bae366a316ecd2a5c8106fcbcf903c43aae90de1 Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Wed, 21 Oct 2020 10:43:42 -0400 Subject: [PATCH] Add waits and only receive check on send --- node-daemon/pvcnoded/VMInstance.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/node-daemon/pvcnoded/VMInstance.py b/node-daemon/pvcnoded/VMInstance.py index c4d74f9b..68b7cb92 100644 --- a/node-daemon/pvcnoded/VMInstance.py +++ b/node-daemon/pvcnoded/VMInstance.py @@ -350,6 +350,10 @@ class VMInstance(object): # Migrate the VM to a target host def migrate_vm(self, force_live=False): + # Wait for any previous migration + while self.inmigrate: + time.sleep(0.1) + self.inmigrate = True self.logger.out('Migrating VM to node "{}"'.format(self.node), state='i', prefix='Domain {}'.format(self.domuuid)) @@ -525,9 +529,9 @@ class VMInstance(object): # Receive the migration from another host def receive_migrate(self): - # Don't try to migrate a node to itself - if self.node == self.lastnode: - return + # Wait for any previous migration + while self.inreceive: + time.sleep(0.1) self.inreceive = True live_receive = True @@ -598,7 +602,7 @@ class VMInstance(object): # The send was shutdown-based zkhandler.writedata(self.zk_conn, { '/domains/{}/state'.format(self.domuuid): 'start' }) else: - # The send failed catastrophically + # 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))