Fix up migration receive

This commit is contained in:
Joshua Boniface 2018-06-02 18:38:59 -04:00
parent a297f9dbcf
commit 97f8030700
1 changed files with 9 additions and 4 deletions

View File

@ -149,16 +149,21 @@ class VMInstance:
self.inreceive = True self.inreceive = True
while True: while True:
try: try:
if self.dom == None or self.dom.state()[0] != libvirt.VIR_DOMAIN_RUNNING: if self.dom == None:
self.dom = conn.lookupByUUID(uuid.UUID(self.domuuid).bytes) self.dom = conn.lookupByUUID(uuid.UUID(self.domuuid).bytes)
elif self.dom.state()[0] != libvirt.VIR_DOMAIN_RUNNING:
continue
else: else:
self.zk.set(self.zkey + '/state', 'start'.encode('ascii'))
if not self.domuuid in self.thishypervisor.domain_list:
self.thishypervisor.domain_list.append(self.domuuid)
break break
except: except:
pass pass
time.sleep(0.2) time.sleep(0.2)
self.zk.set(self.zkey + '/state', 'start'.encode('ascii'))
if not self.domuuid in self.thishypervisor.domain_list:
self.thishypervisor.domain_list.append(self.domuuid)
print('>>> Migrated successfully' % self.domuuid) print('>>> Migrated successfully' % self.domuuid)
self.inreceive = False self.inreceive = False