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());
}
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;
}
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();
}
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);
}
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;
}
Aggregations