Explicitly copy domain_list array
Fixes a bug caused by looping over a changing list of domains during the flush (and unflush) actions. Fixes #7
This commit is contained in:
parent
778eff2d7d
commit
7f3caa2859
|
@ -129,7 +129,10 @@ class NodeInstance():
|
||||||
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')
|
||||||
ansiiprint.echo('Domain list: {}'.format(', '.join(self.domain_list)), '', 'c')
|
ansiiprint.echo('Domain list: {}'.format(', '.join(self.domain_list)), '', 'c')
|
||||||
for dom_uuid in self.domain_list:
|
fixed_domain_list = self.domain_list.copy()
|
||||||
|
for dom_uuid in fixed_domain_list:
|
||||||
|
ansiiprint.echo('Selecting target to migrate VM "{}"'.format(dom_uuid), '', 'i')
|
||||||
|
|
||||||
most_memfree = 0
|
most_memfree = 0
|
||||||
target_hypervisor = None
|
target_hypervisor = None
|
||||||
hypervisor_list = zkhandler.listchildren(self.zk_conn, '/nodes')
|
hypervisor_list = zkhandler.listchildren(self.zk_conn, '/nodes')
|
||||||
|
@ -177,7 +180,8 @@ class NodeInstance():
|
||||||
self.inflush = True
|
self.inflush = True
|
||||||
ansiiprint.echo('Restoring node {} to active service.'.format(self.name), '', 'i')
|
ansiiprint.echo('Restoring node {} to active service.'.format(self.name), '', 'i')
|
||||||
zkhandler.writedata(self.zk_conn, { '/nodes/{}/domainstate'.format(self.name): 'ready' })
|
zkhandler.writedata(self.zk_conn, { '/nodes/{}/domainstate'.format(self.name): 'ready' })
|
||||||
for dom_uuid in self.s_domain:
|
fixed_domain_list = self.s_domain.copy()
|
||||||
|
for dom_uuid in fixed_domain_list:
|
||||||
try:
|
try:
|
||||||
last_hypervisor = zkhandler.readdata(self.zk_conn, '/domains/{}/lasthypervisor'.format(dom_uuid))
|
last_hypervisor = zkhandler.readdata(self.zk_conn, '/domains/{}/lasthypervisor'.format(dom_uuid))
|
||||||
except:
|
except:
|
||||||
|
|
Loading…
Reference in New Issue