From ef492607623268519d57208fab4bfe2c9e397951 Mon Sep 17 00:00:00 2001 From: Joshua Boniface Date: Mon, 11 Jun 2018 17:02:36 -0400 Subject: [PATCH] Some better logic here rather than using and/or --- VMInstance.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/VMInstance.py b/VMInstance.py index 9ef64158..6e33b9bc 100644 --- a/VMInstance.py +++ b/VMInstance.py @@ -212,12 +212,18 @@ class VMInstance: self.dom = self.lookupByUUID(self.domuuid) print(self.state) - if self.dom == None or self.state == 'migrate': + if self.dom == None and self.state == 'migrate': continue - if self.dom.state()[0] == libvirt.VIR_DOMAIN_RUNNING and self.state != 'migrate': + if self.state != 'migrate': break + try: + if self.dom.state()[0] == libvirt.VIR_DOMAIN_RUNNING: + break + except: + continue + if self.dom.state()[0] == libvirt.VIR_DOMAIN_RUNNING: if not self.domuuid in self.thishypervisor.domain_list: self.thishypervisor.domain_list.append(self.domuuid)