Search in sources :

Example 21 with GlusterAsyncTask

use of org.ovirt.engine.core.common.asynctasks.gluster.GlusterAsyncTask in project ovirt-engine by oVirt.

the class GetGlusterVolumeRebalanceStatusQueryTest method getAsyncTask.

private GlusterAsyncTask getAsyncTask() {
    GlusterAsyncTask asyncTask = new GlusterAsyncTask();
    asyncTask.setStepId(STEP_ID);
    asyncTask.setType(GlusterTaskType.REBALANCE);
    asyncTask.setStatus(JobExecutionStatus.FINISHED);
    asyncTask.setMessage("test_msg");
    asyncTask.setTaskId(Guid.newGuid());
    return asyncTask;
}
Also used : GlusterAsyncTask(org.ovirt.engine.core.common.asynctasks.gluster.GlusterAsyncTask)

Example 22 with GlusterAsyncTask

use of org.ovirt.engine.core.common.asynctasks.gluster.GlusterAsyncTask in project ovirt-engine by oVirt.

the class StopRemoveGlusterVolumeBricksCommandTest method getVolumeWithRemoveBricksTask.

@Override
protected GlusterVolumeEntity getVolumeWithRemoveBricksTask(Guid volumeId) {
    GlusterVolumeEntity volume = getVolume(volumeId);
    GlusterAsyncTask asyncTask = new GlusterAsyncTask();
    asyncTask.setStatus(JobExecutionStatus.STARTED);
    asyncTask.setType(GlusterTaskType.REMOVE_BRICK);
    volume.setAsyncTask(asyncTask);
    return volume;
}
Also used : GlusterVolumeEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity) GlusterAsyncTask(org.ovirt.engine.core.common.asynctasks.gluster.GlusterAsyncTask)

Example 23 with GlusterAsyncTask

use of org.ovirt.engine.core.common.asynctasks.gluster.GlusterAsyncTask in project ovirt-engine by oVirt.

the class VolumeListModel method updateActionAvailability.

private void updateActionAvailability() {
    boolean allowStart = true;
    boolean allowStop = true;
    boolean allowRemove = true;
    boolean allowStartRebalance = true;
    boolean allowStopRebalance = true;
    boolean allowStatusRebalance = true;
    boolean allowOptimize = true;
    boolean allowStartProfiling = false;
    boolean allowStopProfiling = false;
    boolean allowProfileStatisticsDetails = false;
    boolean allowConfigureClusterSnapshotOptions = true;
    boolean allowConfigureVolumeSnapshotOptions = false;
    boolean allowCreateSnapshot = false;
    boolean allowEditSnapshotSchedule = false;
    boolean allowCreateGeoRepSession = false;
    if (getSelectedItems() == null || getSelectedItems().size() == 0) {
        allowStart = false;
        allowStop = false;
        allowRemove = false;
        allowStartRebalance = false;
        allowStopRebalance = false;
        allowStatusRebalance = false;
        allowOptimize = false;
    } else {
        List<GlusterVolumeEntity> list = getSelectedItems();
        allowStartProfiling = isStartProfileAvailable(list);
        allowStopProfiling = isStopProfileAvailable(list);
        for (GlusterVolumeEntity volume : list) {
            if (volume.getStatus() == GlusterStatus.UP) {
                VolumeStatus status = GlusterVolumeUtils.getVolumeStatus(volume);
                allowStart = status == VolumeStatus.ALL_BRICKS_DOWN || status == VolumeStatus.SOME_BRICKS_DOWN;
                allowRemove = false;
                if (!volume.getVolumeType().isDistributedType()) {
                    allowStartRebalance = false;
                }
            } else if (volume.getStatus() == GlusterStatus.DOWN) {
                allowStop = false;
                allowStartRebalance = false;
            }
            GlusterAsyncTask asyncTask = volume.getAsyncTask();
            if (asyncTask != null) {
                allowStartRebalance = allowStartRebalance && (asyncTask.getStatus() == null ? asyncTask.getJobStatus() != JobExecutionStatus.STARTED : asyncTask.getStatus() != JobExecutionStatus.STARTED);
            }
        }
        if (list.size() == 1) {
            GlusterVolumeEntity volumeEntity = list.get(0);
            GlusterAsyncTask asyncTask = volumeEntity.getAsyncTask();
            allowStopRebalance = volumeEntity.getStatus() == GlusterStatus.UP && asyncTask != null && asyncTask.getType() == GlusterTaskType.REBALANCE && asyncTask.getStatus() == JobExecutionStatus.STARTED;
            allowConfigureVolumeSnapshotOptions = volumeEntity.getStatus() == GlusterStatus.UP;
            allowCreateGeoRepSession = volumeEntity.getStatus() == GlusterStatus.UP;
            allowCreateSnapshot = isCreateSnapshotAvailable(volumeEntity);
        } else {
            allowStopRebalance = false;
        }
        allowStatusRebalance = getRebalanceStatusAvailability(getSelectedItems());
        allowProfileStatisticsDetails = getProfileStatisticsAvailability(list);
        allowEditSnapshotSchedule = isEditSnapshotScheduleAvailable(list);
    }
    getStartCommand().setIsExecutionAllowed(allowStart);
    getStopCommand().setIsExecutionAllowed(allowStop);
    getRemoveVolumeCommand().setIsExecutionAllowed(allowRemove);
    getStartRebalanceCommand().setIsExecutionAllowed(allowStartRebalance);
    getStopRebalanceCommand().setIsExecutionAllowed(allowStopRebalance);
    getStatusRebalanceCommand().setIsExecutionAllowed(allowStatusRebalance);
    getOptimizeForVirtStoreCommand().setIsExecutionAllowed(allowOptimize);
    getConfigureClusterSnapshotOptionsCommand().setIsExecutionAllowed(allowConfigureClusterSnapshotOptions);
    getConfigureVolumeSnapshotOptionsCommand().setIsExecutionAllowed(allowConfigureVolumeSnapshotOptions);
    getCreateSnapshotCommand().setIsExecutionAllowed(allowCreateSnapshot);
    getEditSnapshotScheduleCommand().setIsExecutionAllowed(allowEditSnapshotSchedule);
    getNewVolumeCommand().setIsAvailable(true);
    getRemoveVolumeCommand().setIsAvailable(true);
    getStartVolumeProfilingCommand().setIsExecutionAllowed(allowStartProfiling);
    getStopVolumeProfilingCommand().setIsExecutionAllowed(allowStopProfiling);
    getShowVolumeProfileDetailsCommand().setIsExecutionAllowed(allowProfileStatisticsDetails);
    getNewGeoRepSessionCommand().setIsExecutionAllowed(allowCreateGeoRepSession);
}
Also used : GlusterVolumeEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity) GlusterAsyncTask(org.ovirt.engine.core.common.asynctasks.gluster.GlusterAsyncTask) VolumeStatus(org.ovirt.engine.ui.frontend.utils.GlusterVolumeUtils.VolumeStatus)

Example 24 with GlusterAsyncTask

use of org.ovirt.engine.core.common.asynctasks.gluster.GlusterAsyncTask in project ovirt-engine by oVirt.

the class GlusterBrickDaoTest method testUpdateBrickTaskByHostIdBrickDir.

@Test
public void testUpdateBrickTaskByHostIdBrickDir() {
    GlusterBrickEntity existingBrick = dao.getById(FixturesTool.GLUSTER_BRICK_UUID1);
    GlusterAsyncTask asyncTask = new GlusterAsyncTask();
    asyncTask.setTaskId(FixturesTool.GLUSTER_ASYNC_TASK_ID1);
    dao.updateBrickTaskByHostIdBrickDir(existingBrick.getServerId(), existingBrick.getBrickDirectory(), FixturesTool.GLUSTER_ASYNC_TASK_ID1);
    GlusterBrickEntity newEnity = dao.getById(FixturesTool.GLUSTER_BRICK_UUID1);
    assertEquals(FixturesTool.GLUSTER_ASYNC_TASK_ID1, newEnity.getAsyncTask().getTaskId());
}
Also used : GlusterBrickEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity) GlusterAsyncTask(org.ovirt.engine.core.common.asynctasks.gluster.GlusterAsyncTask) Test(org.junit.Test)

Example 25 with GlusterAsyncTask

use of org.ovirt.engine.core.common.asynctasks.gluster.GlusterAsyncTask in project ovirt-engine by oVirt.

the class GlusterBrickDaoTest method testUpdateBrickTask.

@Test
public void testUpdateBrickTask() {
    GlusterBrickEntity existingBrick = dao.getById(FixturesTool.GLUSTER_BRICK_UUID1);
    GlusterAsyncTask asyncTask = new GlusterAsyncTask();
    asyncTask.setTaskId(FixturesTool.GLUSTER_ASYNC_TASK_ID1);
    assertNotNull(existingBrick);
    assertEquals(GlusterStatus.UP, existingBrick.getStatus());
    dao.updateBrickTask(existingBrick.getId(), FixturesTool.GLUSTER_ASYNC_TASK_ID1);
    GlusterBrickEntity newEnity = dao.getById(FixturesTool.GLUSTER_BRICK_UUID1);
    assertEquals(FixturesTool.GLUSTER_ASYNC_TASK_ID1, newEnity.getAsyncTask().getTaskId());
}
Also used : GlusterBrickEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity) GlusterAsyncTask(org.ovirt.engine.core.common.asynctasks.gluster.GlusterAsyncTask) Test(org.junit.Test)

Aggregations

GlusterAsyncTask (org.ovirt.engine.core.common.asynctasks.gluster.GlusterAsyncTask)30 GlusterBrickEntity (org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity)11 GlusterVolumeEntity (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity)10 ArrayList (java.util.ArrayList)7 Test (org.junit.Test)5 GlusterTaskParameters (org.ovirt.engine.core.common.asynctasks.gluster.GlusterTaskParameters)4 Step (org.ovirt.engine.core.common.job.Step)4 VDSReturnValue (org.ovirt.engine.core.common.vdscommands.VDSReturnValue)4 Guid (org.ovirt.engine.core.compat.Guid)4 EngineException (org.ovirt.engine.core.common.errors.EngineException)3 UICommand (org.ovirt.engine.ui.uicommonweb.UICommand)3 ConfirmationModel (org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel)3 HashMap (java.util.HashMap)2 HashSet (java.util.HashSet)2 List (java.util.List)2 JobExecutionStatus (org.ovirt.engine.core.common.job.JobExecutionStatus)2 GlusterVolumeRemoveBricksVDSParameters (org.ovirt.engine.core.common.vdscommands.gluster.GlusterVolumeRemoveBricksVDSParameters)2 Collection (java.util.Collection)1 Date (java.util.Date)1 Map (java.util.Map)1