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: except:
self.domain_list.remove(domain) self.domain_list.remove(domain)
# Start any VMs which should be running # Toggle state management of all VMs to start any that are failed
for domain in self.s_domain: for domain, instance in self.s_domain.items():
print(domain.getdomuuid()) if instance.gethypervisor() == self.name and ( instance.getstate() == 'start' or instance.getstate() == 'migrate' ):
instance.manage_vm_state()
# Set our information in zookeeper # Set our information in zookeeper
self.memfree = conn.getFreeMemory() self.memfree = conn.getFreeMemory()

View File

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