Some more cleanups to ake this more readable and efficient
This commit is contained in:
parent
0d30804fc2
commit
4ab180d410
|
@ -141,21 +141,21 @@ class NodeInstance(threading.Thread):
|
|||
self.state = 'flush'
|
||||
|
||||
while True:
|
||||
# Toggle state management of all VMs
|
||||
# Toggle state management of all VMs and remove any non-running VMs
|
||||
for domain, instance in self.s_domain.items():
|
||||
if instance.inshutdown == False and domain in self.domain_list:
|
||||
instance.manage_vm_state()
|
||||
|
||||
# Remove any non-running VMs from our list
|
||||
for domain in self.domain_list:
|
||||
dom = pvcf.lookupByUUID(domain)
|
||||
if dom == None:
|
||||
if instance.dom == None:
|
||||
try:
|
||||
self.domain_list.remove(domain)
|
||||
except:
|
||||
pass
|
||||
else:
|
||||
state = dom.state()[0]
|
||||
try:
|
||||
state = instance.dom.state()[0]
|
||||
except:
|
||||
state = libvirt.VIR_DOMAIN_NOSTATE
|
||||
|
||||
if state != libvirt.VIR_DOMAIN_RUNNING:
|
||||
try:
|
||||
self.domain_list.remove(domain)
|
||||
|
|
Loading…
Reference in New Issue