use of org.ovirt.engine.core.common.asynctasks.gluster.GlusterTaskParameters in project ovirt-engine by oVirt.
the class GlusterTasksListReturn method getTask.
@SuppressWarnings("unchecked")
private GlusterAsyncTask getTask(String taskId, Map<String, Object> map) {
GlusterAsyncTask task = new GlusterAsyncTask();
task.setTaskId(Guid.createGuidFromString(taskId));
task.setStatus(GlusterAsyncTaskStatus.from((String) map.get(STATUS)).getJobExecutionStatus());
task.setType(GlusterTaskType.fromValue((String) map.get(TASK_TYPE)));
if (GlusterTaskType.UNKNOWN != task.getType()) {
task.setMessage(getMessage((Map<String, Object>) map.get(DATA)));
task.setTaskParameters(new GlusterTaskParameters());
task.getTaskParameters().setVolumeName((String) map.get(VOLUME_NAME));
task.getTaskParameters().setBricks(getBrickNames(map.get(BRICK_NAMES)));
}
return task;
}
use of org.ovirt.engine.core.common.asynctasks.gluster.GlusterTaskParameters in project ovirt-engine by oVirt.
the class GetGlusterVolumeRemoveBricksStatusQueryTest 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());
GlusterTaskParameters params = new GlusterTaskParameters();
params.setVolumeName("volume1");
asyncTask.setTaskParameters(params);
return asyncTask;
}
use of org.ovirt.engine.core.common.asynctasks.gluster.GlusterTaskParameters in project ovirt-engine by oVirt.
the class GlusterTasksSyncJobTest method createTask.
private GlusterAsyncTask createTask(Guid guid, JobExecutionStatus status) {
GlusterAsyncTask task = new GlusterAsyncTask();
task.setTaskId(guid);
task.setTaskParameters(new GlusterTaskParameters());
task.getTaskParameters().setVolumeName("VOL");
task.setMessage("message");
task.setStatus(status);
task.setType(GlusterTaskType.REBALANCE);
return task;
}
use of org.ovirt.engine.core.common.asynctasks.gluster.GlusterTaskParameters in project ovirt-engine by oVirt.
the class GlusterTaskUtils method getMessageMap.
public Map<String, String> getMessageMap(Cluster cluster, GlusterAsyncTask task) {
Map<String, String> values = new HashMap<>();
values.put(GlusterConstants.CLUSTER, cluster.getName());
GlusterTaskParameters params = task.getTaskParameters();
values.put(GlusterConstants.VOLUME, params != null ? params.getVolumeName() : "");
String jobStatus = getJobStatusInfo(task);
values.put(GlusterConstants.JOB_STATUS, jobStatus);
values.put(GlusterConstants.JOB_INFO, task.getMessage());
return values;
}
use of org.ovirt.engine.core.common.asynctasks.gluster.GlusterTaskParameters in project ovirt-engine by oVirt.
the class GlusterAsyncTaskStatusQueryBase method updateLatestStatus.
private void updateLatestStatus(GlusterVolumeTaskStatusEntity status) {
GlusterAsyncTask asyncTask = volume.getAsyncTask();
if (asyncTask != null && asyncTask.getTaskId() != null) {
GlusterTaskParameters taskParameters = new GlusterTaskParameters();
taskParameters.setVolumeName(volume.getName());
asyncTask.setTaskParameters(taskParameters);
List<Step> stepsList = stepDao.getStepsByExternalId(asyncTask.getTaskId());
// if step has already ended, do not update status.
if (stepsList != null && !stepsList.isEmpty() && stepsList.get(0).getEndTime() != null) {
asyncTask.setStatus(status.getStatusSummary().getStatus());
asyncTask.setMessage(glusterTaskUtils.getSummaryMessage(status.getStatusSummary()));
glusterTaskUtils.updateSteps(clusterDao.get(clusterId), asyncTask, stepsList);
// release the volume lock if the task is completed
if (glusterTaskUtils.hasTaskCompleted(asyncTask)) {
glusterTaskUtils.releaseLock(volume.getId());
}
}
}
}
Aggregations