Some better logic here rather than using and/or

This commit is contained in:
Joshua Boniface 2018-06-11 17:02:36 -04:00
parent 50f34810bc
commit ef49260762
1 changed files with 8 additions and 2 deletions

View File

@ -212,12 +212,18 @@ class VMInstance:
self.dom = self.lookupByUUID(self.domuuid) self.dom = self.lookupByUUID(self.domuuid)
print(self.state) print(self.state)
if self.dom == None or self.state == 'migrate': if self.dom == None and self.state == 'migrate':
continue continue
if self.dom.state()[0] == libvirt.VIR_DOMAIN_RUNNING and self.state != 'migrate': if self.state != 'migrate':
break break
try:
if self.dom.state()[0] == libvirt.VIR_DOMAIN_RUNNING:
break
except:
continue
if self.dom.state()[0] == libvirt.VIR_DOMAIN_RUNNING: if self.dom.state()[0] == libvirt.VIR_DOMAIN_RUNNING:
if not self.domuuid in self.thishypervisor.domain_list: if not self.domuuid in self.thishypervisor.domain_list:
self.thishypervisor.domain_list.append(self.domuuid) self.thishypervisor.domain_list.append(self.domuuid)