Search in sources :

Example 11 with GlusterVolumeTaskStatusEntity

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

the class GetGlusterVolumeRebalanceStatusQueryTest 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 12 with GlusterVolumeTaskStatusEntity

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

the class StopRemoveGlusterVolumeBricksCommandTest method mockBackend.

private void mockBackend(boolean succeeded, EngineError errorCode) {
    doNothing().when(cmd).endStepJobAborted(any());
    doNothing().when(cmd).releaseVolumeLock();
    VDSReturnValue vdsReturnValue = new VDSReturnValue();
    vdsReturnValue.setSucceeded(succeeded);
    if (!succeeded) {
        vdsReturnValue.setVdsError(new VDSError(errorCode, ""));
    } else {
        vdsReturnValue.setReturnValue(new GlusterVolumeTaskStatusEntity());
    }
    when(vdsBrokerFrontend.runVdsCommand(eq(VDSCommandType.StopRemoveGlusterVolumeBricks), 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 13 with GlusterVolumeTaskStatusEntity

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

the class StopRebalanceGlusterVolumeCommand method executeCommand.

@Override
protected void executeCommand() {
    VDSReturnValue vdsReturnaValue = runVdsCommand(VDSCommandType.StopRebalanceGlusterVolume, new GlusterVolumeVDSParameters(upServer.getId(), getGlusterVolumeName()));
    if (!vdsReturnaValue.getSucceeded()) {
        handleVdsError(AuditLogType.GLUSTER_VOLUME_REBALANCE_STOP_FAILED, vdsReturnaValue.getVdsError().getMessage());
        setSucceeded(false);
        return;
    }
    GlusterVolumeTaskStatusEntity rebalanceStatusEntity = (GlusterVolumeTaskStatusEntity) vdsReturnaValue.getReturnValue();
    JobExecutionStatus stepStatus = rebalanceStatusEntity.getStatusSummary().getStatus();
    if (stepStatus != null) {
        endStepJob(stepStatus, getStepMessageMap(stepStatus, glusterTaskUtils.getSummaryMessage(rebalanceStatusEntity.getStatusSummary())), glusterTaskUtils.isTaskSuccess(stepStatus));
    } else {
        endStepJob(JobExecutionStatus.ABORTED, getStepMessageMap(JobExecutionStatus.ABORTED, null), false);
    }
    releaseVolumeLock();
    setSucceeded(vdsReturnaValue.getSucceeded());
    getReturnValue().setActionReturnValue(rebalanceStatusEntity);
}
Also used : JobExecutionStatus(org.ovirt.engine.core.common.job.JobExecutionStatus) GlusterVolumeTaskStatusEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeTaskStatusEntity) GlusterVolumeVDSParameters(org.ovirt.engine.core.common.vdscommands.gluster.GlusterVolumeVDSParameters) VDSReturnValue(org.ovirt.engine.core.common.vdscommands.VDSReturnValue)

Example 14 with GlusterVolumeTaskStatusEntity

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

the class StopRemoveGlusterVolumeBricksCommand method executeCommand.

@Override
protected void executeCommand() {
    GlusterVolumeEntity volume = getGlusterVolume();
    VDSReturnValue returnValue = runVdsCommand(VDSCommandType.StopRemoveGlusterVolumeBricks, new GlusterVolumeRemoveBricksVDSParameters(getUpServer().getId(), volume.getName(), getParameters().getBricks()));
    setSucceeded(returnValue.getSucceeded());
    if (!getSucceeded()) {
        handleVdsError(AuditLogType.GLUSTER_VOLUME_REMOVE_BRICKS_FAILED, returnValue.getVdsError().getMessage());
        return;
    }
    GlusterVolumeTaskStatusEntity rebalanceStatusEntity = (GlusterVolumeTaskStatusEntity) returnValue.getReturnValue();
    endStepJobAborted(glusterTaskUtils.getSummaryMessage(rebalanceStatusEntity.getStatusSummary()));
    releaseVolumeLock();
    getReturnValue().setActionReturnValue(rebalanceStatusEntity);
}
Also used : GlusterVolumeEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity) 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 15 with GlusterVolumeTaskStatusEntity

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

the class StopRebalanceGlusterVolumeVDSCommand method executeVdsBrokerCommand.

@Override
protected void executeVdsBrokerCommand() {
    String volumeName = getParameters().getVolumeName();
    result = getBroker().glusterVolumeRebalanceStop(volumeName);
    proceedProxyReturnValue();
    // Set the current engine time as status time
    GlusterVolumeTaskStatusEntity entity = result.getStatusDetails();
    entity.setStatusTime(new Date());
    setReturnValue(entity);
}
Also used : GlusterVolumeTaskStatusEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeTaskStatusEntity) Date(java.util.Date)

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