[#1] Fix bug with migrates not clearing list
This commit is contained in:
parent
9627be498e
commit
ccfbf9a874
|
@ -68,16 +68,22 @@ class VMInstance:
|
||||||
def addDomainToList(self):
|
def addDomainToList(self):
|
||||||
if not self.domuuid in self.thishypervisor.domain_list:
|
if not self.domuuid in self.thishypervisor.domain_list:
|
||||||
try:
|
try:
|
||||||
|
# Add the domain to the domain_list array
|
||||||
self.thishypervisor.domain_list.append(self.domuuid)
|
self.thishypervisor.domain_list.append(self.domuuid)
|
||||||
|
# Push the change up to Zookeeper
|
||||||
|
self.zk_conn.set('/nodes/{}/runningdomains'.format(self.thishypervisor.name), ' '.join(self.thishypervisor.domain_list).encode('ascii'))
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
ansiiprint.echo('ERROR: {}'.format(e), '', 'c')
|
ansiiprint.echo('Error adding domain to list: {}'.format(e), '', 'c')
|
||||||
|
|
||||||
def removeDomainFromList(self):
|
def removeDomainFromList(self):
|
||||||
if self.domuuid in self.thishypervisor.domain_list:
|
if self.domuuid in self.thishypervisor.domain_list:
|
||||||
try:
|
try:
|
||||||
|
# Remove the domain from the domain_list array
|
||||||
self.thishypervisor.domain_list.remove(self.domuuid)
|
self.thishypervisor.domain_list.remove(self.domuuid)
|
||||||
|
# Push the change up to Zookeeper
|
||||||
|
self.zk_conn.set('/nodes/{}/runningdomains'.format(self.thishypervisor.name), ' '.join(self.thishypervisor.domain_list).encode('ascii'))
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
ansiiprint.echo('ERROR: {}'.format(e), '', 'c')
|
ansiiprint.echo('Error removing domain from list: {}'.format(e), '', 'c')
|
||||||
|
|
||||||
# Start up the VM
|
# Start up the VM
|
||||||
def start_vm(self):
|
def start_vm(self):
|
||||||
|
@ -216,7 +222,12 @@ class VMInstance:
|
||||||
def migrate_vm(self):
|
def migrate_vm(self):
|
||||||
self.inmigrate = True
|
self.inmigrate = True
|
||||||
ansiiprint.echo('Migrating VM to hypervisor "{}"'.format(self.hypervisor), '{}:'.format(self.domuuid), 'i')
|
ansiiprint.echo('Migrating VM to hypervisor "{}"'.format(self.hypervisor), '{}:'.format(self.domuuid), 'i')
|
||||||
migrate_ret = self.live_migrate_vm(self.hypervisor)
|
|
||||||
|
try:
|
||||||
|
migrate_ret = self.live_migrate_vm(self.hypervisor)
|
||||||
|
except:
|
||||||
|
migrate_ret = 0
|
||||||
|
|
||||||
if migrate_ret != 0:
|
if migrate_ret != 0:
|
||||||
ansiiprint.echo('Could not live migrate VM; shutting down to migrate instead', '{}:'.format(self.domuuid), 'e')
|
ansiiprint.echo('Could not live migrate VM; shutting down to migrate instead', '{}:'.format(self.domuuid), 'e')
|
||||||
self.shutdown_vm()
|
self.shutdown_vm()
|
||||||
|
|
Loading…
Reference in New Issue