Sahina Bose has uploaded a new change for review. Change subject: engine: Add job subject entity when adding job from cli ......................................................................
engine: Add job subject entity when adding job from cli When creating a job for a gluster task detected from cli, the job subject entity table needs to be populated as well. This is needed for the gluster_task_steps view to pick the correct entries. Change-Id: I7996c5b2c52f276f40777fa485cf1a70ba76f381 Bug-Url: https://bugzilla.redhat.com/1040959 Signed-off-by: Sahina Bose <sab...@redhat.com> --- M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddInternalJobCommand.java M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GlusterTasksSyncJob.java M backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/AddInternalJobParameters.java 3 files changed, 37 insertions(+), 1 deletion(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/35/22335/1 diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddInternalJobCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddInternalJobCommand.java index 398cd9b..9ba7ef0 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddInternalJobCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddInternalJobCommand.java @@ -7,6 +7,7 @@ import org.ovirt.engine.core.common.VdcObjectType; import org.ovirt.engine.core.common.action.AddInternalJobParameters; import org.ovirt.engine.core.common.errors.VdcBllMessages; +import org.ovirt.engine.core.compat.Guid; /** * @@ -35,6 +36,9 @@ @Override protected void executeCommand() { createJob(getParameters().getActionType(), false); + if (getSucceeded() && getParameters().getJobEntityType() != null && getParameters().getJobEntityId() != null) { + getDbFacade().getJobSubjectEntityDao().save((Guid)getActionReturnValue(), getParameters().getJobEntityId(), getParameters().getJobEntityType()); + } } @Override diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GlusterTasksSyncJob.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GlusterTasksSyncJob.java index 5df229b..7591800 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GlusterTasksSyncJob.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GlusterTasksSyncJob.java @@ -17,6 +17,7 @@ import org.ovirt.engine.core.bll.job.JobRepository; import org.ovirt.engine.core.bll.job.JobRepositoryFactory; import org.ovirt.engine.core.common.AuditLogType; +import org.ovirt.engine.core.common.VdcObjectType; import org.ovirt.engine.core.common.action.AddInternalJobParameters; import org.ovirt.engine.core.common.action.AddStepParameters; import org.ovirt.engine.core.common.action.VdcActionType; @@ -187,9 +188,12 @@ } private Guid addJob(VDSGroup cluster, GlusterAsyncTask task, VdcActionType actionType) { + String volumeName = task.getTaskParameters().getVolumeName(); + GlusterVolumeEntity vol = getVolumeDao().getByName(cluster.getId(), volumeName); + VdcReturnValueBase result = getBackend().runInternalAction(VdcActionType.AddInternalJob, new AddInternalJobParameters(ExecutionMessageDirector.resolveJobMessage(actionType, getGlusterTaskUtils().getMessageMap(cluster, task)), - actionType, true) ); + actionType, true, VdcObjectType.GlusterVolume, vol.getId()) ); if (!result.getSucceeded()) { //log and return throw new VdcBLLException(result.getFault().getError()); diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/AddInternalJobParameters.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/AddInternalJobParameters.java index fac1e5c..44429ad 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/AddInternalJobParameters.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/AddInternalJobParameters.java @@ -1,9 +1,14 @@ package org.ovirt.engine.core.common.action; +import org.ovirt.engine.core.common.VdcObjectType; +import org.ovirt.engine.core.compat.Guid; + public class AddInternalJobParameters extends AddJobParameters { private static final long serialVersionUID = -7824725232199970355L; private VdcActionType actionType; + private VdcObjectType jobEntityType; + private Guid jobEntityId; public AddInternalJobParameters() { } @@ -21,6 +26,13 @@ this.isAutoCleared = isAutoCleared; } + public AddInternalJobParameters(String description, VdcActionType actionType, boolean isAutoCleared, + VdcObjectType jobEntityType, Guid jobEntityId) { + this(description, actionType, isAutoCleared); + this.jobEntityType = jobEntityType; + this.jobEntityId = jobEntityId; + } + public VdcActionType getActionType() { return actionType; } @@ -29,4 +41,20 @@ this.actionType = actionType; } + public VdcObjectType getJobEntityType() { + return jobEntityType; + } + + public void setJobEntityType(VdcObjectType jobEntityType) { + this.jobEntityType = jobEntityType; + } + + public Guid getJobEntityId() { + return jobEntityId; + } + + public void setJobEntityId(Guid jobEntityId) { + this.jobEntityId = jobEntityId; + } + } -- To view, visit http://gerrit.ovirt.org/22335 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I7996c5b2c52f276f40777fa485cf1a70ba76f381 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Sahina Bose <sab...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches