Ravi Nori has uploaded a new change for review.

Change subject: engine : Command Executor should persist command before 
submitting to threadpool
......................................................................

engine : Command Executor should persist command before submitting to threadpool

Command Coordinator should persist command before
submitting command to thread pool for execution. On
server restarted the commands that have not started
execution should automatically submitted for execution.

Change-Id: I4d510836dc822a95198dc1db4a4f74206466f0c9
Bug-Url: https://bugzilla.redhat.com/1113256
Signed-off-by: Ravi Nori <[email protected]>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/tasks/CommandExecutor.java
1 file changed, 11 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/19/29219/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 c20739f..7284d93 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
@@ -66,9 +66,6 @@
                     coco.updateCallBackNotified(cmdId);
                     iterator.remove();
                     break;
-                case ACTIVE_SYNC:
-                    
coco.retrieveCommand(cmdId).setCommandStatus(CommandStatus.FAILED_RESTARTED);
-                    break;
                 case ACTIVE:
                 case ACTIVE_ASYNC:
                     callBack.doPolling(cmdId, coco.getChildCommandIds(cmdId));
@@ -85,7 +82,16 @@
                 if (!cmdExecutorInitialized) {
                     for (CommandEntity cmdEntity : 
coco.getCommandsWithCallBackEnabled()) {
                         if (!cmdEntity.isCallBackNotified()) {
-                            addToCallBackMap(cmdEntity);
+                            switch(cmdEntity.getCommandStatus()) {
+                                case ACTIVE_SYNC:
+                                    
coco.retrieveCommand(cmdEntity.getId()).setCommandStatus(CommandStatus.FAILED_RESTARTED);
+                                    break;
+                                case NOT_STARTED:
+                                    
executeAsyncCommand(cmdEntity.getCommandType(), 
cmdEntity.getActionParameters());
+                                    break;
+                                default:
+                                    addToCallBackMap(cmdEntity);
+                            }
                         }
                     }
                     cmdExecutorInitialized = true;
@@ -106,6 +112,7 @@
     public Future<VdcReturnValueBase> executeAsyncCommand(final VdcActionType 
actionType,
                                                           final 
VdcActionParametersBase parameters) {
         final CommandBase<?> command = 
CommandsFactory.createCommand(actionType, parameters);
+        command.persistCommand(command.getParameters().getParentCommand(), 
true);
         return executor.submit(new Callable<VdcReturnValueBase>() {
 
             @Override
@@ -116,7 +123,6 @@
     }
 
     private VdcReturnValueBase executeCommand(final CommandBase<?> command) {
-        command.persistCommand(command.getParameters().getParentCommand(), 
true);
         CommandCallBack callBack = command.getCallBack();
         if (callBack != null) {
             cmdCallBackMap.put(command.getCommandId(), callBack);


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

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

Reply via email to