Fix up state toggles

This commit is contained in:
Joshua Boniface 2018-06-02 15:19:29 -04:00
parent 8ac429dad8
commit beef743dd6
2 changed files with 7 additions and 9 deletions

View File

@ -106,9 +106,10 @@ class NodeInstance(threading.Thread):
except:
self.domain_list.remove(domain)
# Start any VMs which should be running
for domain in self.s_domain:
print(domain.getdomuuid())
# 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()

View File

@ -30,14 +30,11 @@ class VMInstance:
self.manage_vm_state()
# Get data functions
def getdomuuid():
return self.domuuid
def getstate():
def getstate(self):
return self.state
def getdom():
return self.dom
def gethypervisor(self):
return self.hypervisor
# Start up the VM
def start_vm(self, conn, xmlconfig):