Arik Hadas has uploaded a new change for review.

Change subject: core: keep engine lock after execute stage for async commands
......................................................................

core: keep engine lock after execute stage for async commands

The engine lock is automatically released when the command ends the
execute method with no tasks, even if the command is set to keep the
locks for the whole command lifecycle. It should be that way for most of
the commands, but not for async commands (which implement
IVdsAsyncCommand) because such command always end the execute method
with no tasks and we don't want their locks to be released after its
execution when they are set to keep their lock for the entire execution.

Thus this patch adds a check that prevents the engine lock from being
released after the execute method for async commands.

Change-Id: I5f7ef28a1ddef613b457aa47a85d9c0b5ce7a8d7
Bug-Url: https://bugzilla.redhat.com/891634
Signed-off-by: Arik Hadas <aha...@redhat.com>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CommandBase.java
1 file changed, 3 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/70/18470/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CommandBase.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CommandBase.java
index 12e36eb..d9168df 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CommandBase.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CommandBase.java
@@ -57,6 +57,7 @@
 import org.ovirt.engine.core.common.businessentities.BusinessEntitySnapshot;
 import 
org.ovirt.engine.core.common.businessentities.BusinessEntitySnapshot.EntityStatusSnapshot;
 import 
org.ovirt.engine.core.common.businessentities.BusinessEntitySnapshot.SnapshotType;
+import org.ovirt.engine.core.common.businessentities.IVdsAsyncCommand;
 import org.ovirt.engine.core.common.businessentities.QuotaEnforcementTypeEnum;
 import org.ovirt.engine.core.common.businessentities.tags;
 import org.ovirt.engine.core.common.errors.VdcBLLException;
@@ -1840,7 +1841,8 @@
     }
 
     private void freeLockExecute() {
-        if (releaseLocksAtEndOfExecute || !getSucceeded() || !hasTasks()) {
+        if (releaseLocksAtEndOfExecute || !getSucceeded() ||
+                (!hasTasks() && !(this instanceof IVdsAsyncCommand))) {
             freeLock();
         }
     }


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5f7ef28a1ddef613b457aa47a85d9c0b5ce7a8d7
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