Arik Hadas has uploaded a new change for review. Change subject: xcxv ......................................................................
xcxv Change-Id: I6dc8e13f1ab932283557b3cbf16a34e72b9b3a69 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, 22 insertions(+), 13 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/43/23643/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 d8339cb..a536940 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 @@ -78,11 +78,11 @@ } @Override - protected void failedToRunVm() { + protected void processVmPoolOnStopVm() { // In case the migration failed and the VM turned back to Up in the // source, we don't need to handle it as a VM that failed to run if (getVm().getStatus() != VMStatus.Up) { - super.failedToRunVm(); + super.processVmPoolOnStopVm(); } } 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 da57403..187a822 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 @@ -11,7 +11,6 @@ import org.apache.commons.lang.StringUtils; import org.ovirt.engine.core.bll.job.ExecutionContext; -import org.ovirt.engine.core.bll.job.ExecutionContext.ExecutionMethod; import org.ovirt.engine.core.bll.job.ExecutionHandler; import org.ovirt.engine.core.bll.job.JobRepositoryFactory; import org.ovirt.engine.core.bll.scheduling.RunVmDelayer; @@ -134,11 +133,10 @@ protected void failedToRunVm() { log(); processVmPoolOnStopVm(); - ExecutionHandler.setAsyncJob(getExecutionContext(), false); - ExecutionHandler.endJob(getExecutionContext(), false); + endJobOrStep(); } - private void processVmPoolOnStopVm() { + protected void processVmPoolOnStopVm() { ThreadPoolUtil.execute(new Runnable() { @Override public void run() { @@ -222,14 +220,25 @@ @Override public void reportCompleted() { + try { + endJobOrStep(); + } + finally { + freeLock(); + } + } + + private void endJobOrStep() { ExecutionContext executionContext = getExecutionContext(); - if (executionContext != null && executionContext.isMonitored()) { - if (!executionContext.isCompleted()) { - if (executionContext.getExecutionMethod() == ExecutionMethod.AsJob) { - ExecutionHandler.endJob(executionContext, false); - } else if (executionContext.getExecutionMethod() == ExecutionMethod.AsStep) { - ExecutionHandler.endStep(executionContext, executionContext.getStep(), false); - } + if (executionContext != null && executionContext.isMonitored() + && !executionContext.isCompleted()) { + switch (executionContext.getExecutionMethod()) { + case AsJob: + ExecutionHandler.endJob(executionContext, false); + break; + case AsStep: + ExecutionHandler.endStep(executionContext, executionContext.getStep(), false); + break; } } } -- To view, visit http://gerrit.ovirt.org/23643 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I6dc8e13f1ab932283557b3cbf16a34e72b9b3a69 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