Search in sources :

Example 36 with ActionReturnValue

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);
}
Also used : ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue) BaseDisk(org.ovirt.engine.core.common.businessentities.storage.BaseDisk) RemoveDiskParameters(org.ovirt.engine.core.common.action.RemoveDiskParameters)

Example 37 with ActionReturnValue

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());
}
Also used : ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue) Test(org.junit.Test)

Example 38 with ActionReturnValue

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;
}
Also used : Response(javax.ws.rs.core.Response) GlusterBricks(org.ovirt.engine.api.model.GlusterBricks) ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue) WebApplicationException(javax.ws.rs.WebApplicationException)

Example 39 with ActionReturnValue

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);
}
Also used : Cluster(org.ovirt.engine.core.common.businessentities.Cluster) Host(org.ovirt.engine.api.model.Host) ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue) UpdateVdsActionParameters(org.ovirt.engine.core.common.action.hostdeploy.UpdateVdsActionParameters) ChangeVDSClusterParameters(org.ovirt.engine.core.common.action.ChangeVDSClusterParameters) Test(org.junit.Test)

Example 40 with ActionReturnValue

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);
}
Also used : Cluster(org.ovirt.engine.core.common.businessentities.Cluster) Host(org.ovirt.engine.api.model.Host) ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue) UpdateVdsActionParameters(org.ovirt.engine.core.common.action.hostdeploy.UpdateVdsActionParameters) ChangeVDSClusterParameters(org.ovirt.engine.core.common.action.ChangeVDSClusterParameters) Test(org.junit.Test)

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