Make this work better and stop bad VMs

This commit is contained in:
2018-06-02 15:26:37 -04:00
parent beef743dd6
commit 87954559a1
2 changed files with 17 additions and 8 deletions

View File

@ -95,7 +95,11 @@ class NodeInstance(threading.Thread):
print("CPUs: %s" % self.cpucount)
while True:
# Make sure that the VMs we think we're running actually are
# Toggle state management of all VMs
for domain, instance in self.s_domain.items():
instance.manage_vm_state()
# Remove non-running VMs from our list
for domain in self.domain_list:
try:
buuid = uuid.UUID(domain).bytes
@ -106,11 +110,6 @@ class NodeInstance(threading.Thread):
except:
self.domain_list.remove(domain)
# Toggle state management of all VMs to start any that are failed
for domain, instance in self.s_domain.items():
if instance.gethypervisor() == self.name and ( instance.getstate() == 'start' or instance.getstate() == 'migrate' ):
instance.manage_vm_state()
# Set our information in zookeeper
self.memfree = conn.getFreeMemory()
self.cpuload = os.getloadavg()[0]