From 0826b508ad268884720da5a00dcd61a2b55bfa08 Mon Sep 17 00:00:00 2001 From: Joshua Boniface Date: Sat, 2 Jun 2018 15:54:43 -0400 Subject: [PATCH] Fix some startup weirdness in ordering --- VMInstance.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/VMInstance.py b/VMInstance.py index 1610372a..8858077e 100644 --- a/VMInstance.py +++ b/VMInstance.py @@ -152,6 +152,12 @@ class VMInstance: elif running == libvirt.VIR_DOMAIN_RUNNING and self.state == "start" and self.hypervisor != self.thishypervisor.name: self.migrate_vm() + # VM is already running and should be + elif running == libvirt.VIR_DOMAIN_RUNNING and self.state == "start" and self.hypervisor == self.thishypervisor.name: + if not self.domuuid in self.thishypervisor.domain_list: + self.thishypervisor.domain_list.append(self.domuuid) + self.dom = conn.lookupByUUID(uuid.UUID(self.domuuid).bytes) + # VM should be started elif running != libvirt.VIR_DOMAIN_RUNNING and self.state == "start" and self.hypervisor == self.thishypervisor.name: # Grab the domain information from Zookeeper @@ -159,10 +165,5 @@ class VMInstance: domxml = str(domxml.decode('ascii')) self.start_vm(conn, domxml) - # VM is already running and should be - elif running == libvirt.VIR_DOMAIN_RUNNING and self.state == "start" and self.hypervisor == self.thishypervisor.name: - if not self.domuuid in self.thishypervisor.domain_list: - self.thishypervisor.domain_list.append(self.domuuid) - # The VM should now be running so return the domain and active connection conn.close