Search in sources :

Example 6 with GlusterVolumeTaskStatusEntity

use of org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeTaskStatusEntity in project ovirt-engine by oVirt.

the class StopRebalanceGlusterVolumeCommandTest method mockBackend.

private void mockBackend(boolean succeeded, JobExecutionStatus rebalanceStopStatus, boolean isRebalancegTaskCompleted, EngineError errorCode) {
    doReturn("TestVDS").when(cmd).getClusterName();
    doReturn("TestVolume").when(cmd).getGlusterVolumeName();
    doNothing().when(cmd).endStepJob(eq(rebalanceStopStatus), any(), eq(isRebalancegTaskCompleted));
    doNothing().when(cmd).releaseVolumeLock();
    VDSReturnValue vdsReturnValue = new VDSReturnValue();
    GlusterVolumeTaskStatusEntity rebalanceStatusEntity = new GlusterVolumeTaskStatusEntity();
    rebalanceStatusEntity.getStatusSummary().setStatus(rebalanceStopStatus);
    vdsReturnValue.setReturnValue(rebalanceStatusEntity);
    vdsReturnValue.setSucceeded(succeeded);
    if (!succeeded) {
        vdsReturnValue.setVdsError(new VDSError(errorCode, ""));
    }
    when(vdsBrokerFrontend.runVdsCommand(eq(VDSCommandType.StopRebalanceGlusterVolume), any())).thenReturn(vdsReturnValue);
}
Also used : VDSError(org.ovirt.engine.core.common.errors.VDSError) GlusterVolumeTaskStatusEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeTaskStatusEntity) VDSReturnValue(org.ovirt.engine.core.common.vdscommands.VDSReturnValue)

Example 7 with GlusterVolumeTaskStatusEntity

use of org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeTaskStatusEntity in project ovirt-engine by oVirt.

the class GetGlusterVolumeRemoveBricksStatusQueryTest method setupExpectedVolume.

private void setupExpectedVolume() {
    expectedVolumeStatusDetails = new GlusterVolumeTaskStatusEntity();
    expectedVolumeStatusDetails.setHostwiseStatusDetails(getHostwiseStatusDetails());
    expectedVolumeStatusDetails.setStatusSummary(getStatusSummary());
    expectedVolumeStatusDetails.setStartTime(new Date());
    expectedVolumeStatusDetails.setStatusTime(new Date());
}
Also used : GlusterVolumeTaskStatusEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeTaskStatusEntity) Date(java.util.Date)

Example 8 with GlusterVolumeTaskStatusEntity

use of org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeTaskStatusEntity in project ovirt-engine by oVirt.

the class GetGlusterVolumeRemoveBricksStatusQueryTest method testQueryForStatusDetails.

@Test
public void testQueryForStatusDetails() {
    doReturn(VOLUME_ID).when(getQueryParameters()).getVolumeId();
    when(vdsDao.get(SERVER_ID)).thenReturn(getVds(VDSStatus.Up));
    when(glusterUtils.getUpServer(CLUSTER_ID)).thenReturn(getVds(VDSStatus.Up));
    getQuery().executeQueryCommand();
    GlusterVolumeTaskStatusEntity volumeStatusDetails = getQuery().getQueryReturnValue().getReturnValue();
    assertNotNull(volumeStatusDetails);
    assertEquals(expectedVolumeStatusDetails, volumeStatusDetails);
    verify(volumeDao, times(1)).getById(VOLUME_ID);
}
Also used : GlusterVolumeTaskStatusEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeTaskStatusEntity) Test(org.junit.Test) AbstractQueryTest(org.ovirt.engine.core.bll.AbstractQueryTest)

Example 9 with GlusterVolumeTaskStatusEntity

use of org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeTaskStatusEntity in project ovirt-engine by oVirt.

the class GetGlusterVolumeRemoveBricksStatusQuery method fetchTaskStatusDetails.

@Override
protected GlusterVolumeTaskStatusEntity fetchTaskStatusDetails() {
    VDSReturnValue returnValue = runVdsCommand(VDSCommandType.GetGlusterVolumeRemoveBricksStatus, new GlusterVolumeRemoveBricksVDSParameters(getUpServerId(clusterId), volume.getName(), getParameters().getBricks(), volume.getReplicaCount()));
    GlusterVolumeTaskStatusEntity entity = (GlusterVolumeTaskStatusEntity) returnValue.getReturnValue();
    // Update the latest status details
    GlusterAsyncTask asyncTask = volume.getAsyncTask();
    if (asyncTask != null) {
        // take a copy of the task status with engine for further use
        JobExecutionStatus jobStatusWithEngine = volume.getAsyncTask().getStatus();
        // update the status entity with required details
        updateStatusEntity(entity);
        // be set to aborted. This is required only in case of remove bricks
        if (jobStatusWithEngine == JobExecutionStatus.ABORTED) {
            entity.getStatusSummary().setStatus(JobExecutionStatus.ABORTED);
        }
    }
    return entity;
}
Also used : JobExecutionStatus(org.ovirt.engine.core.common.job.JobExecutionStatus) GlusterAsyncTask(org.ovirt.engine.core.common.asynctasks.gluster.GlusterAsyncTask) GlusterVolumeRemoveBricksVDSParameters(org.ovirt.engine.core.common.vdscommands.gluster.GlusterVolumeRemoveBricksVDSParameters) GlusterVolumeTaskStatusEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeTaskStatusEntity) VDSReturnValue(org.ovirt.engine.core.common.vdscommands.VDSReturnValue)

Example 10 with GlusterVolumeTaskStatusEntity

use of org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeTaskStatusEntity in project ovirt-engine by oVirt.

the class GetGlusterVolumeRebalanceStatusQueryTest method testQueryForStatusDetails.

@Test
public void testQueryForStatusDetails() {
    doReturn(VOLUME_ID).when(getQueryParameters()).getVolumeId();
    when(vdsDao.get(SERVER_ID)).thenReturn(getVds(VDSStatus.Up));
    when(glusterUtils.getUpServer(CLUSTER_ID)).thenReturn(getVds(VDSStatus.Up));
    getQuery().executeQueryCommand();
    GlusterVolumeTaskStatusEntity volumeStatusDetails = getQuery().getQueryReturnValue().getReturnValue();
    assertNotNull(volumeStatusDetails);
    assertEquals(expectedVolumeStatusDetails, volumeStatusDetails);
    verify(volumeDao, times(1)).getById(VOLUME_ID);
}
Also used : GlusterVolumeTaskStatusEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeTaskStatusEntity) Test(org.junit.Test) AbstractQueryTest(org.ovirt.engine.core.bll.AbstractQueryTest)

Aggregations

GlusterVolumeTaskStatusEntity (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeTaskStatusEntity)16 Date (java.util.Date)6 JobExecutionStatus (org.ovirt.engine.core.common.job.JobExecutionStatus)4 VDSReturnValue (org.ovirt.engine.core.common.vdscommands.VDSReturnValue)4 ArrayList (java.util.ArrayList)3 GlusterAsyncTask (org.ovirt.engine.core.common.asynctasks.gluster.GlusterAsyncTask)3 GlusterBrickEntity (org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity)3 GlusterVolumeEntity (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity)3 List (java.util.List)2 Test (org.junit.Test)2 AbstractQueryTest (org.ovirt.engine.core.bll.AbstractQueryTest)2 ActionReturnValue (org.ovirt.engine.core.common.action.ActionReturnValue)2 ActionType (org.ovirt.engine.core.common.action.ActionType)2 GlusterTaskType (org.ovirt.engine.core.common.asynctasks.gluster.GlusterTaskType)2 GlusterVolumeType (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeType)2 ConfigValues (org.ovirt.engine.core.common.config.ConfigValues)2 GetConfigurationValueParameters (org.ovirt.engine.core.common.queries.GetConfigurationValueParameters)2 GlusterVolumeRemoveBricksVDSParameters (org.ovirt.engine.core.common.vdscommands.gluster.GlusterVolumeRemoveBricksVDSParameters)2 Frontend (org.ovirt.engine.ui.frontend.Frontend)2 UICommand (org.ovirt.engine.ui.uicommonweb.UICommand)2