Search in sources :

Example 6 with VmManagementParametersBase

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

the class BackendVmCdromsResource method add.

public Response add(Cdrom cdrom) {
    validateParameters(cdrom, "file.id");
    VM vm = getVm();
    vm = map(cdrom, vm);
    VmManagementParametersBase parameters = new VmManagementParametersBase(vm);
    return performCreate(ActionType.UpdateVm, parameters, new VmResolver());
}
Also used : VM(org.ovirt.engine.core.common.businessentities.VM) VmManagementParametersBase(org.ovirt.engine.core.common.action.VmManagementParametersBase)

Example 7 with VmManagementParametersBase

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

the class UpdateVmCommandTest method initParams.

private static VmManagementParametersBase initParams() {
    VmStatic vmStatic = new VmStatic();
    vmStatic.setClusterId(clusterId);
    vmStatic.setName("my_vm");
    vmStatic.setMaxMemorySizeMb(MAX_MEMORY_SIZE);
    vmStatic.setMemSizeMb(MEMORY_SIZE);
    VmManagementParametersBase params = new VmManagementParametersBase();
    params.setCommandType(ActionType.UpdateVm);
    params.setVmStaticData(vmStatic);
    params.setUpdateNuma(true);
    return params;
}
Also used : VmStatic(org.ovirt.engine.core.common.businessentities.VmStatic) VmManagementParametersBase(org.ovirt.engine.core.common.action.VmManagementParametersBase)

Example 8 with VmManagementParametersBase

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

the class BackendVmCdromResource method update.

@Override
public Cdrom update(Cdrom cdrom) {
    validateParameters(cdrom, "file");
    boolean current = ParametersHelper.getBooleanParameter(httpHeaders, uriInfo, CURRENT, true, false);
    if (current) {
        ChangeDiskCommandParameters parameters = new ChangeDiskCommandParameters(vmId, cdrom.getFile().getId());
        performAction(ActionType.ChangeDisk, parameters);
    } else {
        VM vm = getVm();
        vm = map(cdrom, vm);
        VmManagementParametersBase parameters = new VmManagementParametersBase(vm);
        performAction(ActionType.UpdateVm, parameters);
    }
    return get();
}
Also used : ChangeDiskCommandParameters(org.ovirt.engine.core.common.action.ChangeDiskCommandParameters) VM(org.ovirt.engine.core.common.businessentities.VM) VmManagementParametersBase(org.ovirt.engine.core.common.action.VmManagementParametersBase)

Example 9 with VmManagementParametersBase

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

the class BackendVmCdromResource method remove.

public Response remove() {
    VM vm = getVm();
    vm.setIsoPath(null);
    VmManagementParametersBase parameters = new VmManagementParametersBase(vm);
    return performAction(ActionType.UpdateVm, parameters);
}
Also used : VM(org.ovirt.engine.core.common.businessentities.VM) VmManagementParametersBase(org.ovirt.engine.core.common.action.VmManagementParametersBase)

Example 10 with VmManagementParametersBase

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

the class TryBackToAllSnapshotsOfVmCommand method updateVm.

private boolean updateVm(VmStatic vm, Version oldClusterVersion, boolean disableLock) {
    VmManagementParametersBase updateParams = new VmManagementParametersBase(vm);
    updateParams.setClusterLevelChangeFromVersion(oldClusterVersion);
    CommandContext context;
    if (disableLock) {
        updateParams.setLockProperties(LockProperties.create(LockProperties.Scope.None));
        context = cloneContextAndDetachFromParent();
    } else {
        // Wait for VM lock
        EngineLock updateVmLock = createUpdateVmLock();
        // will be released by UpdateVmCommand
        lockManager.acquireLockWait(updateVmLock);
        context = ExecutionHandler.createInternalJobContext(updateVmLock);
    }
    ActionReturnValue result = runInternalAction(ActionType.UpdateVm, updateParams, context);
    if (!result.getSucceeded()) {
        getReturnValue().setFault(result.getFault());
        return false;
    }
    return true;
}
Also used : CommandContext(org.ovirt.engine.core.bll.context.CommandContext) ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue) VmManagementParametersBase(org.ovirt.engine.core.common.action.VmManagementParametersBase) EngineLock(org.ovirt.engine.core.utils.lock.EngineLock)

Aggregations

VmManagementParametersBase (org.ovirt.engine.core.common.action.VmManagementParametersBase)12 VM (org.ovirt.engine.core.common.businessentities.VM)6 ActionReturnValue (org.ovirt.engine.core.common.action.ActionReturnValue)4 VmStatic (org.ovirt.engine.core.common.businessentities.VmStatic)2 ArrayList (java.util.ArrayList)1 CommandContext (org.ovirt.engine.core.bll.context.CommandContext)1 ChangeDiskCommandParameters (org.ovirt.engine.core.common.action.ChangeDiskCommandParameters)1 ChangeVMClusterParameters (org.ovirt.engine.core.common.action.ChangeVMClusterParameters)1 GraphicsDevice (org.ovirt.engine.core.common.businessentities.GraphicsDevice)1 GraphicsType (org.ovirt.engine.core.common.businessentities.GraphicsType)1 VmDevice (org.ovirt.engine.core.common.businessentities.VmDevice)1 VmPayload (org.ovirt.engine.core.common.businessentities.VmPayload)1 VmRngDevice (org.ovirt.engine.core.common.businessentities.VmRngDevice)1 VmWatchdog (org.ovirt.engine.core.common.businessentities.VmWatchdog)1 Guid (org.ovirt.engine.core.compat.Guid)1 EngineLock (org.ovirt.engine.core.utils.lock.EngineLock)1 UnitToGraphicsDeviceParamsBuilder (org.ovirt.engine.ui.uicommonweb.builders.vm.UnitToGraphicsDeviceParamsBuilder)1 VmIconUnitAndVmToParameterBuilder (org.ovirt.engine.ui.uicommonweb.builders.vm.VmIconUnitAndVmToParameterBuilder)1