Liran Zelkha has uploaded a new change for review.

Change subject: core: VdsNotRespondingTreatment Job is not marked as finished.
......................................................................

core: VdsNotRespondingTreatment Job is not marked as finished.

Once a host is not reachable and VdsNotRespondingTreatment job runs,
the job is always marked as STARTED - never FINISHED/FAILS. This
patch solves this

Change-Id: I9d3d6bc9f409bbcdd5a6b7d2201d8d6eef61ecf5
Bug-Url: https://bugzilla.redhat.com/1075500
Signed-off-by: [email protected] <[email protected]>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsNotRespondingTreatmentCommand.java
1 file changed, 21 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/31/25831/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsNotRespondingTreatmentCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsNotRespondingTreatmentCommand.java
index 97f024a..8a30285 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsNotRespondingTreatmentCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsNotRespondingTreatmentCommand.java
@@ -3,6 +3,8 @@
 import java.util.HashMap;
 import java.util.Map;
 
+import org.apache.commons.lang.ObjectUtils;
+import org.ovirt.engine.core.bll.job.ExecutionContext;
 import org.ovirt.engine.core.common.AuditLogType;
 import org.ovirt.engine.core.common.VdcObjectType;
 import org.ovirt.engine.core.common.action.FenceVdsActionParameters;
@@ -62,7 +64,11 @@
         boolean shouldBeFenced = validator.shouldVdsBeFenced();
         if (shouldBeFenced) {
             
getParameters().setParentCommand(VdcActionType.VdsNotRespondingTreatment);
+            // Make sure that the StopVdsCommand that runs by the RestartVds
+            // don't write over our job, and disrupt marking the job status 
correctly
+            ExecutionContext ec = (ExecutionContext) 
ObjectUtils.clone(this.getExecutionContext());
             super.executeCommand();
+            this.setExecutionContext(ec);
         } else {
             setCommandShouldBeLogged(false);
             log.infoFormat("Host {0}({1}) not fenced since it's status is ok, 
or it doesn't exist anymore.",
@@ -71,6 +77,21 @@
         getReturnValue().setSucceeded(shouldBeFenced);
     }
 
+    private ExecutionContext duplicateExecutionContext(ExecutionContext 
origin) {
+        ExecutionContext context = new ExecutionContext();
+        context.setCompleted(origin.isCompleted());
+        context.setExecutionMethod(origin.getExecutionMethod());
+        context.setJob(origin.getJob());
+        context.setJobRequired(origin.isJobRequired());
+        context.setMonitored(origin.isMonitored());
+        context.setParentTasksStep(origin.getParentTasksStep());
+        context.setShouldEndJob(origin.shouldEndJob());
+        context.setStep(origin.getStep());
+        context.setStepsList(origin.getStepsList());
+        context.setTasksMonitored(origin.isTasksMonitored());
+        return context;
+    }
+
     @Override
     protected void setStatus() {
     }


-- 
To view, visit http://gerrit.ovirt.org/25831
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9d3d6bc9f409bbcdd5a6b7d2201d8d6eef61ecf5
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Liran Zelkha <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to