Oved Ourfali has uploaded a new change for review.

Change subject: engine : CoCo Handle restart logic for commands
......................................................................

engine : CoCo Handle restart logic for commands

When a command has failed due to an exception
in executeCommand method the status of the command
is set to FAILED and the execute flag is false.

If the server is restarted before the callback is
notified the status of the command should not be
set to FAILED_RESTARTED and the callback's onFailed
should called after restart for both FAILED
and FAILED_RESTARTED commands

Change-Id: I9d00ea9d29acfa4894595a978a8376a530c2fc8d
Bug-Url: https://bugzilla.redhat.com/1129885
Signed-off-by: Ravi Nori <[email protected]>
(cherry picked from commit c01ac6733886c0108937251ccbc4948309e41688)
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/tasks/CommandExecutor.java
1 file changed, 6 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/86/31586/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/tasks/CommandExecutor.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/tasks/CommandExecutor.java
index 7322c8b..42c6964 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/tasks/CommandExecutor.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/tasks/CommandExecutor.java
@@ -103,6 +103,7 @@
     private String getCallBackMethod(CommandStatus status) {
         switch (status) {
             case FAILED:
+            case FAILED_RESTARTED:
                 return "onFailed";
             case SUCCEEDED:
                 return "onSucceeded";
@@ -116,9 +117,12 @@
     private void initCommandExecutor() {
         if (!cmdExecutorInitialized) {
             for (CommandEntity cmdEntity : 
coco.getCommandsWithCallBackEnabled()) {
-                if (!cmdEntity.isExecuted()) {
+                if (!cmdEntity.isExecuted() &&
+                        cmdEntity.getCommandStatus() != CommandStatus.FAILED &&
+                        cmdEntity.getCommandStatus() != 
CommandStatus.FAILED_RESTARTED) {
                     
coco.retrieveCommand(cmdEntity.getId()).setCommandStatus(CommandStatus.FAILED_RESTARTED);
-                } else if (!cmdEntity.isCallBackNotified()) {
+                }
+                if (!cmdEntity.isCallBackNotified()) {
                     addToCallBackMap(cmdEntity);
                 }
             }


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9d00ea9d29acfa4894595a978a8376a530c2fc8d
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: ovirt-engine-3.5
Gerrit-Owner: Oved Ourfali <[email protected]>
Gerrit-Reviewer: Ravi Nori <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to