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;
}
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;
}
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);
}
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());
}
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());
}
Aggregations