use of org.ovirt.engine.core.common.action.ActionReturnValue in project ovirt-engine by oVirt.
the class ImportHostedEngineStorageDomainCommand method removeHostedEngineLunDisk.
private void removeHostedEngineLunDisk() {
List<BaseDisk> disks = baseDiskDao.getDisksByAlias(StorageConstants.HOSTED_ENGINE_LUN_DISK_ALIAS);
if (disks != null && !disks.isEmpty()) {
BaseDisk heDirectLun = disks.get(0);
ActionReturnValue removeDisk = backend.runInternalAction(ActionType.RemoveDisk, new RemoveDiskParameters(heDirectLun.getId()));
if (!removeDisk.getSucceeded()) {
setSucceeded(false);
log.error("Failed to remove the hosted engine direct lun disk");
return;
}
}
setSucceeded(true);
}
use of org.ovirt.engine.core.common.action.ActionReturnValue in project ovirt-engine by oVirt.
the class ConfigureConsoleOptionsQueryTest method shouldCallSetTicket.
@Test
public void shouldCallSetTicket() {
when(getQueryParameters().getOptions()).thenReturn(getValidOptions(GraphicsType.VNC));
when(getQueryParameters().isSetTicket()).thenReturn(true);
mockSessionDataContainer();
mockGetCaCertificate();
doReturn(mockVm(GraphicsType.VNC)).when(getQuery()).getCachedVm();
ActionReturnValue result = new ActionReturnValue();
result.setSucceeded(true);
result.setActionReturnValue("nbusr123");
doReturn(result).when(backend).runAction(eq(ActionType.SetVmTicket), any());
getQuery().getQueryReturnValue().setSucceeded(true);
getQuery().executeQueryCommand();
verify(backend, times(1)).runAction(eq(ActionType.SetVmTicket), any());
}
use of org.ovirt.engine.core.common.action.ActionReturnValue in project ovirt-engine by oVirt.
the class BackendGlusterBricksResource method performCreationMultiple.
protected Response performCreationMultiple(ActionType task, ActionParametersBase taskParams, EntityIdResolver<Guid> entityResolver) {
ActionReturnValue createResult;
try {
createResult = doAction(task, taskParams);
} catch (Exception e) {
return handleError(e, false);
}
GlusterBricks model = resolveCreatedList(createResult, entityResolver);
Response response = null;
if (model == null) {
response = Response.status(ACCEPTED_STATUS).build();
} else {
response = Response.created(URI.create(getUriInfo().getPath())).entity(model).build();
}
return response;
}
use of org.ovirt.engine.core.common.action.ActionReturnValue in project ovirt-engine by oVirt.
the class BackendHostResourceTest method testUpdateWithClusterId.
@Test
public void testUpdateWithClusterId() throws Exception {
setUpGetEntityExpectations(3);
setUriInfo(setUpActionExpectations(ActionType.ChangeVDSCluster, ChangeVDSClusterParameters.class, new String[] { "ClusterId", "VdsId" }, new Object[] { GUIDS[1], GUIDS[0] }, true, true, new ActionReturnValue(), false));
setUriInfo(setUpActionExpectations(ActionType.UpdateVds, UpdateVdsActionParameters.class, new String[] { "RootPassword" }, new Object[] { ROOT_PASSWORD }, true, true));
org.ovirt.engine.api.model.Cluster cluster = new org.ovirt.engine.api.model.Cluster();
cluster.setId(GUIDS[1].toString());
Host host = getModel(0);
host.setCluster(cluster);
verifyModel(resource.update(host), 0);
}
use of org.ovirt.engine.core.common.action.ActionReturnValue in project ovirt-engine by oVirt.
the class BackendHostResourceTest method testUpdateWithClusterName.
@Test
public void testUpdateWithClusterName() throws Exception {
String clusterName = "Default";
setUpGetEntityExpectations(3);
setUpEntityQueryExpectations(QueryType.GetClusterByName, NameQueryParameters.class, new String[] { "Name" }, new Object[] { clusterName }, getCluster(clusterName, GUIDS[1]));
setUriInfo(setUpActionExpectations(ActionType.ChangeVDSCluster, ChangeVDSClusterParameters.class, new String[] { "ClusterId", "VdsId" }, new Object[] { GUIDS[1], GUIDS[0] }, true, true, new ActionReturnValue(), false));
setUriInfo(setUpActionExpectations(ActionType.UpdateVds, UpdateVdsActionParameters.class, new String[] { "RootPassword" }, new Object[] { ROOT_PASSWORD }, true, true));
org.ovirt.engine.api.model.Cluster cluster = new org.ovirt.engine.api.model.Cluster();
cluster.setName(clusterName);
Host host = getModel(0);
host.setCluster(cluster);
verifyModel(resource.update(host), 0);
}
Aggregations