Some more debug and a little fix to the terminate check

This commit is contained in:
Joshua Boniface 2018-06-11 22:05:36 -04:00
parent f843f294c9
commit 069696dbd4
2 changed files with 4 additions and 2 deletions

View File

@ -117,7 +117,7 @@ class NodeInstance():
def flush(self): def flush(self):
self.inflush = True self.inflush = True
ansiiprint.echo('Flushing node "{}" of running VMs'.format(self.name), '', 'i') ansiiprint.echo('Flushing node "{}" of running VMs'.format(self.name), '', 'i')
self.zk.set('/nodes/{}/domainstate'.format(self.name), 'flushed'.encode('ascii')) ansiiprint.echo('Domain list: ' + ', '.join(self.domain_list), '', 'i')
for dom_uuid in self.domain_list: for dom_uuid in self.domain_list:
most_memfree = 0 most_memfree = 0
target_hypervisor = None target_hypervisor = None
@ -157,6 +157,7 @@ class NodeInstance():
# Wait 2s between migrations # Wait 2s between migrations
time.sleep(2) time.sleep(2)
self.zk.set('/nodes/{}/domainstate'.format(self.name), 'flushed'.encode('ascii'))
self.inflush = False self.inflush = False
def unflush(self): def unflush(self):

View File

@ -250,6 +250,7 @@ class VMInstance:
print('got there') print('got there')
print(running) print(running)
# VM should be stopped # VM should be stopped
if running == libvirt.VIR_DOMAIN_RUNNING and self.state == "stop" and self.hypervisor == self.thishypervisor.name: if running == libvirt.VIR_DOMAIN_RUNNING and self.state == "stop" and self.hypervisor == self.thishypervisor.name:
self.stop_vm() self.stop_vm()
@ -267,7 +268,7 @@ class VMInstance:
self.migrate_vm() self.migrate_vm()
# VM should be running but not on this hypervisor # 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: elif running == libvirt.VIR_DOMAIN_RUNNING and self.state != "migrate" and self.hypervisor != self.thishypervisor.name:
self.terminate_vm() self.terminate_vm()
# VM is already running and should be # VM is already running and should be