Exemplo n.º 1
0
def _required(params, name):
    if name not in params:
        raise exception.MissingParameter()
    return params[name]
Exemplo n.º 2
0
def require_keys(params, keys):
    missing = [key for key in keys if key not in params]
    if missing:
        raise exception.MissingParameter(missing=missing, params=params)
Exemplo n.º 3
0
from __future__ import absolute_import
from __future__ import division
from vdsm.common import exception

# TODO: Drop after callers changed to raise the exceptions
errCode = {
    'noVM': exception.NoSuchVM().response(),
    'nfsErr': exception.AccessTimeout().response(),
    'exist': exception.VMExists().response(),
    'noVmType': exception.UnsupportedVMType().response(),
    'down': exception.VMIsDown().response(),
    'copyerr': exception.CopyFailed().response(),
    'sparse': exception.CannotCreateSparse().response(),
    'createErr': exception.CannotCreateVM().response(),
    'noConPeer': exception.NoConnectionToPeer().response(),
    'MissParam': exception.MissingParameter().response(),
    'migrateErr': exception.MigrationError().response(),
    'imageErr': exception.ImageFileNotFound().response(),
    'outOfMem': exception.OutOfMemory().response(),
    'unexpected': exception.UnexpectedError().response(),
    'unsupFormat': exception.UnsupportedImageFormat().response(),
    'ticketErr': exception.SpiceTicketError().response(),
    'nonresp': exception.NonResponsiveGuestAgent().response(),
    # codes 20-35 are reserved for add/delNetwork
    # code 39 was used for:
    # wrongHost - migration destination has an invalid hostname
    'unavail': exception.ResourceUnavailable().response(),
    'changeDisk': exception.ChangeDiskFailed().response(),
    'destroyErr': exception.VMDestroyFailed().response(),
    'fenceAgent': exception.UnsupportedFenceAgent().response(),
    'noimpl': exception.MethodNotImplemented().response(),