Add additional state - vm should be stopped as it shouldn't run on that node

This commit is contained in:
Joshua Boniface 2018-06-06 21:45:03 -04:00
parent 6bc935c38a
commit 3f25f89324
1 changed files with 4 additions and 0 deletions

View File

@ -227,6 +227,10 @@ class VMInstance:
elif running == libvirt.VIR_DOMAIN_RUNNING and self.state == "migrate" and self.hypervisor != self.thishypervisor.name and self.inmigrate == False: elif running == libvirt.VIR_DOMAIN_RUNNING and self.state == "migrate" and self.hypervisor != self.thishypervisor.name and self.inmigrate == False:
self.migrate_vm() self.migrate_vm()
# VM should be running but not on this hypervisor
elif running == libvirt.VIR_DOMAIN_RUNNING and self.state == "start" and self.hypervisor != self.thishypervisor.name:
self.stop_vm()
# VM is already running and should be # VM is already running and should be
elif running == libvirt.VIR_DOMAIN_RUNNING and self.state == "start" and self.hypervisor == self.thishypervisor.name: elif running == libvirt.VIR_DOMAIN_RUNNING and self.state == "start" and self.hypervisor == self.thishypervisor.name:
if not self.domuuid in self.thishypervisor.domain_list: if not self.domuuid in self.thishypervisor.domain_list: