Search in sources :

Example 96 with ActionReturnValue

use of org.ovirt.engine.core.common.action.ActionReturnValue in project ovirt-engine by oVirt.

the class ExtendSANStorageDomainCommandTest method passAllValidations.

private void passAllValidations() {
    doReturn(false).when(command).isLunsAlreadyInUse(any());
    doReturn(true).when(command).checkStorageDomain();
    doReturn(true).when(command).checkStorageDomainStatus(StorageDomainStatus.Active);
    storageDomain.setStorageType(StorageType.ISCSI);
    ActionReturnValue connectResult = new ActionReturnValue();
    connectResult.setActionReturnValue(new ArrayList<>());
    connectResult.setSucceeded(true);
    doReturn(connectResult).when(command).connectAllHostsToLun();
}
Also used : ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue)

Example 97 with ActionReturnValue

use of org.ovirt.engine.core.common.action.ActionReturnValue in project ovirt-engine by oVirt.

the class BackendInstanceTypeGraphicsConsolesResource method add.

@Override
public Response add(GraphicsConsole console) {
    GraphicsDevice device = getMapper(GraphicsConsole.class, GraphicsDevice.class).map(console, null);
    device.setVmId(guid);
    ActionReturnValue res = doCreateEntity(ActionType.AddGraphicsAndVideoDevices, createAddGraphicsDeviceParams(device));
    if (res != null && res.getSucceeded()) {
        return BackendGraphicsConsoleHelper.find(console, this::list);
    }
    throw new WebApplicationException(Response.status(Response.Status.NOT_FOUND).build());
}
Also used : GraphicsDevice(org.ovirt.engine.core.common.businessentities.GraphicsDevice) WebApplicationException(javax.ws.rs.WebApplicationException) ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue) GraphicsConsole(org.ovirt.engine.api.model.GraphicsConsole)

Example 98 with ActionReturnValue

use of org.ovirt.engine.core.common.action.ActionReturnValue in project ovirt-engine by oVirt.

the class AddUnmanagedVmsCommand method addExternallyManagedVm.

// Visible for testing
protected void addExternallyManagedVm(VmStatic vmStatic) {
    ActionReturnValue returnValue = runInternalAction(ActionType.AddVmFromScratch, new AddVmParameters(vmStatic), createAddExternalVmContext(vmStatic));
    if (!returnValue.getSucceeded()) {
        log.debug("Failed adding Externally managed VM '{}'", vmStatic.getName());
        return;
    }
    resourceManager.getVmManager(vmStatic.getId()).update(vmStatic);
}
Also used : ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue) AddVmParameters(org.ovirt.engine.core.common.action.AddVmParameters)

Example 99 with ActionReturnValue

use of org.ovirt.engine.core.common.action.ActionReturnValue in project ovirt-engine by oVirt.

the class AddVmAndCloneImageCommand method copyDiskImage.

protected void copyDiskImage(DiskImage diskImage, Guid srcStorageDomainId, Guid destStorageDomainId, Guid diskProfileId, ActionType parentCommandType) {
    DiskImage newDiskImage = imagesHandler.cloneDiskImage(destStorageDomainId, Guid.newGuid(), Guid.newGuid(), diskImage, diskProfileId, getVmSnapshotId(), diskInfoDestinationMap != null ? diskInfoDestinationMap.get(diskImage.getId()) : null);
    ImagesHandler.setDiskAlias(newDiskImage, getVm());
    MoveOrCopyImageGroupParameters parameters = createCopyParameters(newDiskImage, srcStorageDomainId, diskImage.getId(), diskImage.getImageId(), parentCommandType);
    parameters.setRevertDbOperationScope(ImageDbOperationScope.IMAGE);
    ActionReturnValue result = executeChildCopyingCommand(parameters);
    handleCopyResult(diskImage, newDiskImage, result);
}
Also used : MoveOrCopyImageGroupParameters(org.ovirt.engine.core.common.action.MoveOrCopyImageGroupParameters) ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue) DiskImage(org.ovirt.engine.core.common.businessentities.storage.DiskImage)

Example 100 with ActionReturnValue

use of org.ovirt.engine.core.common.action.ActionReturnValue in project ovirt-engine by oVirt.

the class AttachUserToVmFromPoolAndRunCommand method executeCommand.

@Override
protected void executeCommand() {
    initPoolUser();
    ActionReturnValue actionReturnValue = attachUserToVm();
    if (!actionReturnValue.getSucceeded()) {
        log.info("Failed to give user '{}' permission to Vm '{}'", getAdUserId(), getVmId());
        setActionReturnValue(actionReturnValue);
        return;
    } else {
        log.info("Succeeded giving user '{}' permission to Vm '{}'", getAdUserId(), getVmId());
    }
    if (!isVmPrestarted()) {
        // Only when using a VM that is not prestarted we need to run the VM
        actionReturnValue = runVm();
        setSucceeded(actionReturnValue.getSucceeded());
        getReturnValue().getVdsmTaskIdList().addAll(getReturnValue().getInternalVdsmTaskIdList());
    } else {
        // No need to start, just return it
        setSucceeded(true);
    }
    setActionReturnValue(getVmId());
}
Also used : ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue)

Aggregations

ActionReturnValue (org.ovirt.engine.core.common.action.ActionReturnValue)293 ArrayList (java.util.ArrayList)57 Guid (org.ovirt.engine.core.compat.Guid)55 ActionParametersBase (org.ovirt.engine.core.common.action.ActionParametersBase)50 Test (org.junit.Test)37 DiskImage (org.ovirt.engine.core.common.businessentities.storage.DiskImage)27 ActionType (org.ovirt.engine.core.common.action.ActionType)26 EngineException (org.ovirt.engine.core.common.errors.EngineException)25 VDS (org.ovirt.engine.core.common.businessentities.VDS)23 HashSet (java.util.HashSet)16 QueryReturnValue (org.ovirt.engine.core.common.queries.QueryReturnValue)15 ExecutionException (java.util.concurrent.ExecutionException)13 StorageDomain (org.ovirt.engine.core.common.businessentities.StorageDomain)13 CinderDisk (org.ovirt.engine.core.common.businessentities.storage.CinderDisk)13 StorageServerConnectionParametersBase (org.ovirt.engine.core.common.action.StorageServerConnectionParametersBase)12 StoragePool (org.ovirt.engine.core.common.businessentities.StoragePool)12 List (java.util.List)11 ChangeVDSClusterParameters (org.ovirt.engine.core.common.action.ChangeVDSClusterParameters)11 VM (org.ovirt.engine.core.common.businessentities.VM)11 UICommand (org.ovirt.engine.ui.uicommonweb.UICommand)11