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'
|
self.state = 'flush'
|
||||||
|
|
||||||
while True:
|
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():
|
for domain, instance in self.s_domain.items():
|
||||||
if instance.inshutdown == False and domain in self.domain_list:
|
if instance.inshutdown == False and domain in self.domain_list:
|
||||||
instance.manage_vm_state()
|
instance.manage_vm_state()
|
||||||
|
if instance.dom == None:
|
||||||
# Remove any non-running VMs from our list
|
|
||||||
for domain in self.domain_list:
|
|
||||||
dom = pvcf.lookupByUUID(domain)
|
|
||||||
if dom == None:
|
|
||||||
try:
|
try:
|
||||||
self.domain_list.remove(domain)
|
self.domain_list.remove(domain)
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
state = dom.state()[0]
|
try:
|
||||||
|
state = instance.dom.state()[0]
|
||||||
|
except:
|
||||||
|
state = libvirt.VIR_DOMAIN_NOSTATE
|
||||||
|
|
||||||
if state != libvirt.VIR_DOMAIN_RUNNING:
|
if state != libvirt.VIR_DOMAIN_RUNNING:
|
||||||
try:
|
try:
|
||||||
self.domain_list.remove(domain)
|
self.domain_list.remove(domain)
|
||||||
|
|
Loading…
Reference in New Issue