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