Fix missing self reference for ZK conn

This commit is contained in:
Joshua Boniface 2018-06-06 20:49:21 -04:00
parent 700f2e8cc4
commit 90fa2e6b5e
1 changed files with 4 additions and 4 deletions

View File

@ -90,14 +90,14 @@ class NodeInstance():
print('>>> Flushing node {} of running VMs.'.format(self.name)) print('>>> Flushing node {} of running VMs.'.format(self.name))
for dom_uuid in self.domain_list: for dom_uuid in self.domain_list:
most_memfree = 0 most_memfree = 0
hypervisor_list = zk.get_children('/nodes') hypervisor_list = self.zk.get_children('/nodes')
current_hypervisor = zk.get('/dom_uuids/{}/hypervisor'.format(dom_uuid))[0].decode('ascii') current_hypervisor = self.zk.get('/dom_uuids/{}/hypervisor'.format(dom_uuid))[0].decode('ascii')
for hypervisor in hypervisor_list: for hypervisor in hypervisor_list:
state = zk.get('/nodes/{}/state'.format(hypervisor))[0].decode('ascii') state = self.zk.get('/nodes/{}/state'.format(hypervisor))[0].decode('ascii')
if state != 'start' or hypervisor == current_hypervisor: if state != 'start' or hypervisor == current_hypervisor:
continue continue
memfree = int(zk.get('/nodes/{}/memfree'.format(hypervisor))[0].decode('ascii')) memfree = int(self.zk.get('/nodes/{}/memfree'.format(hypervisor))[0].decode('ascii'))
if memfree > most_memfree: if memfree > most_memfree:
most_memfree = memfree most_memfree = memfree
target_hypervisor = hypervisor target_hypervisor = hypervisor