Loading ccserver/election.py +18 −3 Original line number Diff line number Diff line Loading @@ -86,7 +86,16 @@ class Elector(object): distribute = getattr(self, func) # Get the destination hypervisor candidates: candidates = self._get_candidates(self.FILTERS[mtype]) candidates, errors = self._get_candidates(self.FILTERS[mtype]) # Check if VM migration election raised an error: if errors: # If errors are found, we report only the first of them, because we # have currently no way to report problem for each vm: vm, desc = errors[0] raise ElectionError('No destination found for %r, last destination' ' filtered by %s' % (vm['id'], desc)) # Distributes VMs to each candidate: migration_plan = distribute(mtype, candidates) Loading @@ -110,6 +119,7 @@ class Elector(object): hvs = self._server.list(self._query_dest, show=hv_tags) candidates = [] errors = [] # Filters the candidates: for vm in vms: Loading @@ -121,9 +131,14 @@ class Elector(object): vm_dest = copy(hvs) for func, desc in filterfuncs: vm_dest = func(vm, vm_dest) # VM is added to errors if none destination HV is found for it: if not vm_dest: errors.append((vm, desc)) break else: candidates.append((vm, vm_dest)) return candidates return candidates, errors ##### ##### Distribution algorithm methods: Loading Loading
ccserver/election.py +18 −3 Original line number Diff line number Diff line Loading @@ -86,7 +86,16 @@ class Elector(object): distribute = getattr(self, func) # Get the destination hypervisor candidates: candidates = self._get_candidates(self.FILTERS[mtype]) candidates, errors = self._get_candidates(self.FILTERS[mtype]) # Check if VM migration election raised an error: if errors: # If errors are found, we report only the first of them, because we # have currently no way to report problem for each vm: vm, desc = errors[0] raise ElectionError('No destination found for %r, last destination' ' filtered by %s' % (vm['id'], desc)) # Distributes VMs to each candidate: migration_plan = distribute(mtype, candidates) Loading @@ -110,6 +119,7 @@ class Elector(object): hvs = self._server.list(self._query_dest, show=hv_tags) candidates = [] errors = [] # Filters the candidates: for vm in vms: Loading @@ -121,9 +131,14 @@ class Elector(object): vm_dest = copy(hvs) for func, desc in filterfuncs: vm_dest = func(vm, vm_dest) # VM is added to errors if none destination HV is found for it: if not vm_dest: errors.append((vm, desc)) break else: candidates.append((vm, vm_dest)) return candidates return candidates, errors ##### ##### Distribution algorithm methods: Loading