Shireesh Anjal has uploaded a new change for review. Change subject: engine: fix locking issue in GlusterMultipleActionsRunner ......................................................................
engine: fix locking issue in GlusterMultipleActionsRunner GlusterMultipleActionsRunner#executeValidatedCommands() had code to re-acquire the lock released at the end of canDoAction. However, this should not happen in case the CanDoAction had failed, as MultipleActionsRunner#executeValidatedCommand() doesn't even execute the command in this case. Performed a minor refactoring in MultipleActionsRunner as follows: - renamed executeValidatedCommands() to executeValidatedCommand() - executeValidatedCommand() gets called only when canDoAction was success Change-Id: I100603d7155deb67bb2f0a8b451732a0003fbf55 Bug-Url: https://bugzilla.redhat.com/905904 Signed-off-by: Shireesh Anjal <san...@redhat.com> --- M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/GlusterMultipleActionsRunner.java M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MultipleActionsRunner.java M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/AttachStorageDomainsMultipleActionRunner.java 3 files changed, 14 insertions(+), 15 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/97/11597/1 diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/GlusterMultipleActionsRunner.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/GlusterMultipleActionsRunner.java index 600352d..522cec6 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/GlusterMultipleActionsRunner.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/GlusterMultipleActionsRunner.java @@ -24,10 +24,10 @@ } @Override - protected void executeValidatedCommands(CommandBase<?> command) { + protected void executeValidatedCommand(CommandBase<?> command) { // Since we had released the lock at the end of CanDoAction, // it must be acquired back just before execution of the command command.acquireLock(); - super.executeValidatedCommands(command); + super.executeValidatedCommand(command); } } diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MultipleActionsRunner.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MultipleActionsRunner.java index 9fb1495..904cc43 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MultipleActionsRunner.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MultipleActionsRunner.java @@ -160,7 +160,9 @@ protected void RunCommands() { for (CommandBase<?> command : getCommands()) { - executeValidatedCommands(command); + if (command.getReturnValue().getCanDoAction()) { + executeValidatedCommand(command); + } } } @@ -170,18 +172,15 @@ * @param command * The command to execute */ - protected void executeValidatedCommands(CommandBase<?> command) { - if (command.getReturnValue().getCanDoAction()) { - - if (executionContext == null || executionContext.isMonitored()) { - ExecutionHandler.prepareCommandForMonitoring(command, - command.getActionType(), - command.isInternalExecution(), - new Boolean(hasCorrelationIdMap.get(command.getCommandId()))); - } - ThreadLocalParamsContainer.setCorrelationId(command.getCorrelationId()); - command.executeAction(); + protected void executeValidatedCommand(CommandBase<?> command) { + if (executionContext == null || executionContext.isMonitored()) { + ExecutionHandler.prepareCommandForMonitoring(command, + command.getActionType(), + command.isInternalExecution(), + new Boolean(hasCorrelationIdMap.get(command.getCommandId()))); } + ThreadLocalParamsContainer.setCorrelationId(command.getCorrelationId()); + command.executeAction(); } public void setExecutionContext(ExecutionContext executionContext) { diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/AttachStorageDomainsMultipleActionRunner.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/AttachStorageDomainsMultipleActionRunner.java index 3a451a1..786ec61 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/AttachStorageDomainsMultipleActionRunner.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/AttachStorageDomainsMultipleActionRunner.java @@ -65,7 +65,7 @@ @Override public void run() { - executeValidatedCommands(command); + executeValidatedCommand(command); } }); } -- To view, visit http://gerrit.ovirt.org/11597 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I100603d7155deb67bb2f0a8b451732a0003fbf55 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Shireesh Anjal <san...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches