From 236d4720082783d9eb290a4c8632a608b6792dd4 Mon Sep 17 00:00:00 2001 From: Joshua Boniface Date: Mon, 11 Jun 2018 02:03:23 -0400 Subject: [PATCH] Add way out of receive migration --- VMInstance.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/VMInstance.py b/VMInstance.py index e43239a9..a0da4e8c 100644 --- a/VMInstance.py +++ b/VMInstance.py @@ -210,14 +210,18 @@ class VMInstance: time.sleep(0.2) continue - if self.dom.state()[0] == libvirt.VIR_DOMAIN_RUNNING: + if self.dom.state()[0] == libvirt.VIR_DOMAIN_RUNNING or self.state != 'migrate': break - self.zk.set('/domains/{}/state'.format(self.domuuid), 'start'.encode('ascii')) - if not self.domuuid in self.thishypervisor.domain_list: - self.thishypervisor.domain_list.append(self.domuuid) + if self.dom.state()[0] == libvirt.VIR_DOMAIN_RUNNING: + self.zk.set('/domains/{}/state'.format(self.domuuid), 'start'.encode('ascii')) + if not self.domuuid in self.thishypervisor.domain_list: + self.thishypervisor.domain_list.append(self.domuuid) + + ansiiprint.echo('Successfully migrated VM', '{}:'.format(self.domuuid), 'o') + else: + ansiiprint.echo('Failed to receive migrated VM', '{}:'.format(self.domuuid), 'e') - ansiiprint.echo('Successfully migrated VM', '{}:'.format(self.domuuid), 'o') self.inreceive = False #