Commit bac419e2 authored by Antoine Millet's avatar Antoine Millet
Browse files

Fixed error handling on election.

parent e1ee44e0
Loading
Loading
Loading
Loading
+4 −5
Original line number Diff line number Diff line
@@ -9,7 +9,8 @@ from __future__ import absolute_import

from copy import copy

from ccserver.exceptions import UnknownElectionAlgo, UnknownElectionType
from ccserver.exceptions import (UnknownElectionAlgo, UnknownElectionType,
                                 ElectionError)

def tags(*args):
    '''
@@ -126,10 +127,8 @@ class Elector(object):
        hv_alloc = {}
        for vm, hvs in candidates:
            if not hvs:
                migration_plan.append({'sid': vm['id'],
                                       'did': '',
                                       'error': 'no destination hv found',
                                       'type': 'error'})
                raise ElectionError('No destination found for %r vm' % vm['id'])

            else:
                # Try to take an hypervisor that is not already in the plan:
                for hv in hvs:
+4 −0
Original line number Diff line number Diff line
@@ -56,3 +56,7 @@ class UnknownMigrationType(Exception):

class UnknownObjectError(Exception):
    pass


class ElectionError(Exception):
    pass
+1 −0
Original line number Diff line number Diff line
@@ -709,6 +709,7 @@ class CliHandler(OnlineCCHandler):
            else:
                errmsg = '%r unknown migration type' % migration['type']
                errs.error(migration['sid'], errmsg)
                continue

            # Construct the migration properties:
            migration_properties = {