Arik Hadas has uploaded a new change for review.

Change subject: core: dsfsdf
......................................................................

core: dsfsdf

Change-Id: I74bd39fd5a4dc95694e9a059c40f7797b5e97623
Signed-off-by: Arik Hadas <aha...@redhat.com>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MigrateVmCommand.java
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RunVmCommandBase.java
2 files changed, 13 insertions(+), 15 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/42/23642/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MigrateVmCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MigrateVmCommand.java
index d51644e..d8339cb 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MigrateVmCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MigrateVmCommand.java
@@ -91,7 +91,6 @@
             determineMigrationFailureForAuditLog();
             _isRerun = false;
             setSucceeded(false);
-            log();
             failedToRunVm();
         }
         finally {
diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RunVmCommandBase.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RunVmCommandBase.java
index c34ba90..da57403 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RunVmCommandBase.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RunVmCommandBase.java
@@ -94,6 +94,10 @@
         _isRerun = true;
         log();
 
+        // set _isRerun flag to false so that we'll be able to know if
+        // there is another rerun attempt within the method
+        _isRerun = false;
+
         /**
          * Rerun VM only if not exceeded maximum rerun attempts. for example 
if there are 10 hosts that can run VM and
          * predefine maximum 3 attempts to rerun VM - on 4th turn vm will stop 
to run despite there are still available
@@ -110,16 +114,12 @@
                     
JobRepositoryFactory.getJobRepository().closeCompletedJobSteps(job.getId(), 
JobExecutionStatus.FAILED);
                 }
             }
-            // set the _isRerun flag to false before calling executeAction so 
that we'll know if
-            // there is another rerun attempt within the method
-            _isRerun = false;
             insertAsyncTaskPlaceHolders();
             executeAction();
 
             // if there was no rerun attempt in the previous executeAction 
call and the command
             // wasn't done because canDoAction check returned false..
             if (!_isRerun && !getReturnValue().getCanDoAction()) {
-                log();
                 failedToRunVm();
             }
 
@@ -128,25 +128,24 @@
         } else {
             
Backend.getInstance().getResourceManager().RemoveAsyncRunningCommand(getVmId());
             failedToRunVm();
-            _isRerun = false;
-            log();
         }
     }
 
     protected void failedToRunVm() {
-        ThreadPoolUtil.execute(new Runnable() {
-            @Override
-            public void run() {
-                processVmPoolOnStopVm();
-            }
-        });
+        log();
+        processVmPoolOnStopVm();
         ExecutionHandler.setAsyncJob(getExecutionContext(), false);
         ExecutionHandler.endJob(getExecutionContext(), false);
     }
 
     private void processVmPoolOnStopVm() {
-        VmPoolHandler.processVmPoolOnStopVm(getVm().getId(),
-                
ExecutionHandler.createDefaultContexForTasks(getExecutionContext()));
+        ThreadPoolUtil.execute(new Runnable() {
+            @Override
+            public void run() {
+                VmPoolHandler.processVmPoolOnStopVm(getVm().getId(),
+                        
ExecutionHandler.createDefaultContexForTasks(getExecutionContext()));
+            }
+        });
     }
 
     /**


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I74bd39fd5a4dc95694e9a059c40f7797b5e97623
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Arik Hadas <aha...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to