Add way out of receive migration

This commit is contained in:
Joshua Boniface 2018-06-11 02:03:23 -04:00
parent 0dfae84be7
commit 236d472008
1 changed files with 9 additions and 5 deletions

View File

@ -210,14 +210,18 @@ class VMInstance:
time.sleep(0.2) time.sleep(0.2)
continue continue
if self.dom.state()[0] == libvirt.VIR_DOMAIN_RUNNING: if self.dom.state()[0] == libvirt.VIR_DOMAIN_RUNNING or self.state != 'migrate':
break break
if self.dom.state()[0] == libvirt.VIR_DOMAIN_RUNNING:
self.zk.set('/domains/{}/state'.format(self.domuuid), 'start'.encode('ascii')) self.zk.set('/domains/{}/state'.format(self.domuuid), 'start'.encode('ascii'))
if not self.domuuid in self.thishypervisor.domain_list: if not self.domuuid in self.thishypervisor.domain_list:
self.thishypervisor.domain_list.append(self.domuuid) self.thishypervisor.domain_list.append(self.domuuid)
ansiiprint.echo('Successfully migrated VM', '{}:'.format(self.domuuid), 'o') ansiiprint.echo('Successfully migrated VM', '{}:'.format(self.domuuid), 'o')
else:
ansiiprint.echo('Failed to receive migrated VM', '{}:'.format(self.domuuid), 'e')
self.inreceive = False self.inreceive = False
# #