Oved Ourfali has uploaded a new change for review.

Change subject: core: Change cluster command should lock host
......................................................................

core: Change cluster command should lock host

This patch adds a missing lock when host cluster is changed.
Prior to this change the host was not locked allowing a concurrent
removal of the host to occur while the change cluster operation is still
running this resulted on a SQL exception while trying to add a line to
host SPM mapping table with a host GUID when the host was already
removed.

Change-Id: I1cd9e237838ce03438d806160d08efc9db0d6cd7
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1102729
Signed-off-by: Eli Mesika <emes...@redhat.com>
(cherry picked from commit abe3413e0e8c7056f764ebfc06e7c43b13371d0e)
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ChangeVDSClusterCommand.java
1 file changed, 17 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/61/32961/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ChangeVDSClusterCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ChangeVDSClusterCommand.java
index cddab10..207331c 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ChangeVDSClusterCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ChangeVDSClusterCommand.java
@@ -17,6 +17,7 @@
 import org.ovirt.engine.core.common.FeatureSupported;
 import org.ovirt.engine.core.common.VdcObjectType;
 import org.ovirt.engine.core.common.action.ChangeVDSClusterParameters;
+import org.ovirt.engine.core.common.action.LockProperties;
 import org.ovirt.engine.core.common.action.PersistentSetupNetworksParameters;
 import org.ovirt.engine.core.common.action.VdcActionType;
 import org.ovirt.engine.core.common.action.VdcReturnValueBase;
@@ -34,6 +35,8 @@
 import org.ovirt.engine.core.common.errors.VdcBLLException;
 import org.ovirt.engine.core.common.errors.VdcBllErrors;
 import org.ovirt.engine.core.common.errors.VdcBllMessages;
+import org.ovirt.engine.core.common.locks.LockingGroup;
+import org.ovirt.engine.core.common.utils.Pair;
 import org.ovirt.engine.core.common.vdscommands.VDSCommandType;
 import org.ovirt.engine.core.common.vdscommands.VDSReturnValue;
 import 
org.ovirt.engine.core.common.vdscommands.gluster.AddGlusterServerVDSParameters;
@@ -530,4 +533,18 @@
             return networksByLabel;
         }
     }
+
+    @Override
+    protected LockProperties applyLockProperties(LockProperties 
lockProperties) {
+        return lockProperties.withScope(LockProperties.Scope.Execution);
+    }
+
+    @Override
+    protected Map<String, Pair<String, String>> getExclusiveLocks() {
+        Map<String, Pair<String, String>> locks = new HashMap<String, 
Pair<String, String>>();
+        locks.put(getParameters().getVdsId().toString(),
+                LockMessagesMatchUtil.makeLockingPair(LockingGroup.VDS,
+                        VdcBllMessages.ACTION_TYPE_FAILED_OBJECT_LOCKED));
+        return locks;
+    }
 }


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1cd9e237838ce03438d806160d08efc9db0d6cd7
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: ovirt-engine-3.5
Gerrit-Owner: Oved Ourfali <oourf...@redhat.com>
Gerrit-Reviewer: Eli Mesika <emes...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to