Gilad Chaplik has posted comments on this change.
Change subject: engine: Support for gluster asynchronous tasks(WIP)
......................................................................
Patch Set 3: (9 inline comments)
Hi Sahina,
How are you going to handle zombie tasks?
....................................................
File
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GlusterTaskManager.java
Line 24:
Line 25: public final class GlusterTaskManager {
Line 26: private static final Log log =
LogFactory.getLog(GlusterTaskManager.class);
Line 27:
Line 28: private final List<Guid> glusterTasksList = new ArrayList<Guid>();
maybe map is better
Line 29:
Line 30: private static GlusterTaskManager _taskMgr = new
GlusterTaskManager();
Line 31:
Line 32: public static GlusterTaskManager getInstance() {
Line 66: for (Guid taskId : glusterTasksList) {
Line 67: //get status of task from vdsm
Line 68: GlusterAsyncTask task =
GlusterTaskStatusUtil.getTaskStatus(taskId);
Line 69: //get step from db for the corresponding gluster task
Line 70: List<Step> steps =
DbFacade.getInstance().getStepDao().getStepsByExternalId(taskId);
dao call within a synchronized method? not sure it is the best thing.
Line 71: //update status in step table
Line 72: for (Step step: steps) {
Line 73: step.setDescription(getTaskMessage(step,task));
Line 74: if (hasTaskCompleted(task)) {
Line 80: } else {
Line 81:
JobRepositoryFactory.getJobRepository().updateStep(step);
Line 82: }
Line 83: }
Line 84: }
monitoring logic should be extracted.
Line 85: for (Guid removeTaskId : toRemoveList) {
Line 86: removeTask(removeTaskId);
Line 87: }
Line 88:
Line 154: }
Line 155:
Line 156: private void initializeTasks() {
Line 157: //get external tasks from DB where not completed.
Line 158: //May not be required if we use gluster Tasks list from UP
server for each cluster
serious question. how do you handle tasks when host goes to !up?
Line 159:
Line 160: initAndCleanupOrphanTasks();
Line 161: }
....................................................
File
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/RebalanceGlusterVolumeCommand.java
Line 19: * This may be a long running operation and so the returned task id is
used to update
Line 20: * the status of the step and the corresponding job.
Line 21: */
Line 22: @NonTransactiveCommandAttribute
Line 23: public class RebalanceGlusterVolumeCommand extends
GlusterAsyncCommandBase<GlusterVolumeRebalanceParameters> {
separate patch?
Line 24:
Line 25: private static final long serialVersionUID = 8747137699199502912L;
Line 26:
Line 27: public
RebalanceGlusterVolumeCommand(GlusterVolumeRebalanceParameters params) {
....................................................
File
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/gluster/GlusterAsyncTask.java
Line 3: import java.io.Serializable;
Line 4:
Line 5: import org.ovirt.engine.core.compat.Guid;
Line 6:
Line 7: public class GlusterAsyncTask implements Serializable{
looks like AsyncTasks?
Line 8:
Line 9: private static final long serialVersionUID = 5165089908032934194L;
Line 10:
Line 11: private Guid taskId;
....................................................
File
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/gluster/GlusterTaskStatus.java
Line 2:
Line 3: import java.util.HashMap;
Line 4: import java.util.Map;
Line 5:
Line 6: public enum GlusterTaskStatus {
looks like AsyncTaskState?
Line 7: RUNNING(0),
Line 8: FAILED(1),
Line 9: COMPLETED(2),
Line 10: ABORTED(3),
....................................................
File
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/gluster/GlusterTaskType.java
Line 5:
Line 6: import org.ovirt.engine.core.common.action.VdcActionType;
Line 7: import org.ovirt.engine.core.common.job.StepEnum;
Line 8:
Line 9: public enum GlusterTaskType {
looks like AsyncTaskType
Line 10:
REBALANCE(VdcActionType.RebalanceGlusterVolume,StepEnum.REBALANCING_VOLUME),
Line 11: REPLACE_BRICK(VdcActionType.ReplaceGlusterVolumeBrick);
Line 12: // REMOVE_BRICK(VdcActionType.DeleteGlusterVolume); //TODO: change
Line 13:
....................................................
File
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/job/ExternalSystemType.java
Line 1: package org.ovirt.engine.core.common.job;
Line 2:
Line 3: public enum ExternalSystemType {
Line 4: VDSM,
Line 5: GLUSTER;
where do you use it? failed to find.
Line 6:
Line 7: static public ExternalSystemType safeValueOf(String value) {
Line 8: if (value == null) {
Line 9: return null;
--
To view, visit http://gerrit.ovirt.org/11840
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I8a56785edef091bce74e2b7b0ba9a3314f1397f1
Gerrit-PatchSet: 3
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Sahina Bose <[email protected]>
Gerrit-Reviewer: Eli Mesika <[email protected]>
Gerrit-Reviewer: Gilad Chaplik <[email protected]>
Gerrit-Reviewer: Michael Kublin <[email protected]>
Gerrit-Reviewer: Sahina Bose <[email protected]>
Gerrit-Reviewer: Shireesh Anjal <[email protected]>
Gerrit-Reviewer: Yair Zaslavsky <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches