def spawn_mdev(mdev_type, mdev_uuid, mdev_placement, log): device = _suitable_device_for_mdev_type(mdev_type, mdev_placement, log) if device is None: message = 'vgpu: No device with type {} is available'.format(mdev_type) log.error(message) raise exception.ResourceUnavailable(message) try: supervdsm.getProxy().mdev_create(device, mdev_type, mdev_uuid) except IOError: message = 'vgpu: Failed to create mdev type {}'.format(mdev_type) log.error(message) raise exception.ResourceUnavailable(message)
def despawn_mdev(mdev_uuid): device = None for dev in _each_mdev_device(): if mdev_uuid in os.listdir(os.path.join(_MDEV_PATH, dev)): device = dev break if device is None or mdev_uuid is None: raise exception.ResourceUnavailable('vgpu: No mdev found') try: supervdsm.getProxy().mdev_delete(device, mdev_uuid) except IOError: # This is destroy flow, we can't really fail pass
'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(), 'hotplugDisk': exception.HotplugDiskFailed().response(), 'hotunplugDisk': exception.HotunplugDiskFailed().response(), 'migCancelErr': exception.MigrationCancelationFailed().response(), 'snapshotErr': exception.SnapshotFailed().response(), 'hotplugNic': exception.HotplugNicFailed().response(), 'hotunplugNic': exception.HotunplugNicFailed().response(), 'migInProgress': exception.MigrationInProgress().response(), 'mergeErr': exception.MergeFailed().response(), 'balloonErr': exception.BalloonError().response(), 'momErr': exception.MOMPolicyUpdateFailed().response(), 'replicaErr': exception.ReplicaError().response(),