From 17ecf0ad4f26e80ac9046f328d42c5241a83ed61 Mon Sep 17 00:00:00 2001 From: micafer Date: Tue, 2 Oct 2018 13:20:01 +0200 Subject: [PATCH] Fix error selecting the master VM --- IM/InfrastructureInfo.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/IM/InfrastructureInfo.py b/IM/InfrastructureInfo.py index df00f660f..0e4c2c694 100644 --- a/IM/InfrastructureInfo.py +++ b/IM/InfrastructureInfo.py @@ -428,8 +428,8 @@ def select_vm_master(self): and store the value in the vm_master field """ self.vm_master = None + max_vms_connected = -1 for vm in self.get_vm_list(): - max_vms_connected = -1 vms_connected = -1 if vm.getOS() and vm.getOS().lower() == 'linux' and vm.hasPublicNet(): # check that is connected with other VMs @@ -438,8 +438,9 @@ def select_vm_master(self): if not vm.isConnectedWith(other_vm): vms_connected += 1 - if vms_connected > max_vms_connected: - self.vm_master = vm + if vms_connected > max_vms_connected: + max_vms_connected = vms_connected + self.vm_master = vm def vm_in_ctxt_tasks(self, vm): found = False