Timothy Asir has uploaded a new change for review. Change subject: gluster: fix to remove multiple host when hosts are in maintenance ......................................................................
gluster: fix to remove multiple host when hosts are in maintenance Add and release lock only for gluster command execution Change-Id: I0f74af59dc0723eda46ac1b7c53b2a980c49fda4 Signed-off-by: Timothy Asir <tjeya...@redhat.com> Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=987494 --- M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveVdsCommand.java 1 file changed, 16 insertions(+), 20 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/65/21865/1 diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveVdsCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveVdsCommand.java index 74db518..0db5fb2 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveVdsCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveVdsCommand.java @@ -6,6 +6,7 @@ import org.apache.commons.lang.StringUtils; import org.ovirt.engine.core.bll.utils.ClusterUtils; +import org.ovirt.engine.core.bll.utils.GlusterUtil; import org.ovirt.engine.core.common.AuditLogType; import org.ovirt.engine.core.common.action.RemoveVdsParameters; import org.ovirt.engine.core.common.businessentities.StoragePool; @@ -24,6 +25,7 @@ import org.ovirt.engine.core.dal.dbbroker.DbFacade; import org.ovirt.engine.core.dao.VdsDynamicDAO; import org.ovirt.engine.core.dao.gluster.GlusterBrickDao; +import org.ovirt.engine.core.utils.lock.EngineLock; import org.ovirt.engine.core.utils.transaction.TransactionMethod; import org.ovirt.engine.core.utils.transaction.TransactionSupport; @@ -205,18 +207,20 @@ private void glusterHostRemove() { if (clusterHasMultipleHosts() && !hasVolumeBricksOnServer()) { - VDSReturnValue returnValue = - runVdsCommand( - VDSCommandType.RemoveGlusterServer, - new RemoveGlusterServerVDSParameters(upServer.getId(), - getVds().getHostName(), - getParameters().isForceAction())); - setSucceeded(returnValue.getSucceeded()); - if (!getSucceeded()) { - getReturnValue().getFault().setError(returnValue.getVdsError().getCode()); - getReturnValue().getFault().setMessage(returnValue.getVdsError().getMessage()); - errorType = AuditLogType.GLUSTER_SERVER_REMOVE_FAILED; - return; + try (EngineLock lock = GlusterUtil.getInstance().acquireGlusterLockWait(getVds().getVdsGroupId())) { + VDSReturnValue returnValue = + runVdsCommand( + VDSCommandType.RemoveGlusterServer, + new RemoveGlusterServerVDSParameters(upServer.getId(), + getVds().getHostName(), + getParameters().isForceAction())); + setSucceeded(returnValue.getSucceeded()); + if (!getSucceeded()) { + getReturnValue().getFault().setError(returnValue.getVdsError().getCode()); + getReturnValue().getFault().setMessage(returnValue.getVdsError().getMessage()); + errorType = AuditLogType.GLUSTER_SERVER_REMOVE_FAILED; + return; + } } } } @@ -235,14 +239,6 @@ LockMessagesMatchUtil.makeLockingPair(LockingGroup.VDS, VdcBllMessages.ACTION_TYPE_FAILED_OBJECT_LOCKED)); } - - // Need to acquire lock on cluster if the host belongs to a gluster cluster - if (cluster != null && cluster.supportsGlusterService()) { - locks.put(cluster.getId().toString(), - LockMessagesMatchUtil.makeLockingPair(LockingGroup.GLUSTER, - VdcBllMessages.ACTION_TYPE_FAILED_OBJECT_LOCKED)); - } - return locks; } } -- To view, visit http://gerrit.ovirt.org/21865 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I0f74af59dc0723eda46ac1b7c53b2a980c49fda4 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Timothy Asir <tjeya...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches