Try to fix some weird bugs with receive migrate
This commit is contained in:
parent
7309d22a17
commit
fdea02b888
|
@ -206,10 +206,12 @@ class VMInstance:
|
||||||
ansiiprint.echo('Receiving migration', '{}:'.format(self.domuuid), 'i')
|
ansiiprint.echo('Receiving migration', '{}:'.format(self.domuuid), 'i')
|
||||||
self.inreceive = True
|
self.inreceive = True
|
||||||
while True:
|
while True:
|
||||||
|
time.sleep(0.2)
|
||||||
|
self.state = self.zk.get('/domains/{}/state'.format(self.domuuid))[0].decode('ascii')
|
||||||
self.dom = self.lookupByUUID(self.domuuid)
|
self.dom = self.lookupByUUID(self.domuuid)
|
||||||
print(self.state)
|
print(self.state)
|
||||||
|
|
||||||
if self.dom == None and self.state == 'migrate':
|
if self.dom == None and self.state == 'migrate':
|
||||||
time.sleep(0.2)
|
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if self.dom.state()[0] == libvirt.VIR_DOMAIN_RUNNING or self.state != 'migrate':
|
if self.dom.state()[0] == libvirt.VIR_DOMAIN_RUNNING or self.state != 'migrate':
|
||||||
|
@ -222,6 +224,7 @@ class VMInstance:
|
||||||
|
|
||||||
ansiiprint.echo('Successfully received migrated VM', '{}:'.format(self.domuuid), 'o')
|
ansiiprint.echo('Successfully received migrated VM', '{}:'.format(self.domuuid), 'o')
|
||||||
else:
|
else:
|
||||||
|
self.zk.set('/domains/{}/state'.format(self.domuuid), 'start'.encode('ascii'))
|
||||||
ansiiprint.echo('Failed to receive migrated VM', '{}:'.format(self.domuuid), 'e')
|
ansiiprint.echo('Failed to receive migrated VM', '{}:'.format(self.domuuid), 'e')
|
||||||
|
|
||||||
self.inreceive = False
|
self.inreceive = False
|
||||||
|
|
Loading…
Reference in New Issue