Greg Padgett has uploaded a new change for review. Change subject: core: Allow task handlers to drive CommandExecutor commands ......................................................................
core: Allow task handlers to drive CommandExecutor commands Small fixes to allow commands run via CommandExecutor to be called by task handlers. The parent command's doPolling() method can now check the command status and call endAction() to pass control to the next task handler when appropriate without prematurely ending the command. In case of failure, the entire command hierarchy will be failed, whereas previously the parent command would still end successfully. Change-Id: I85f54aea19774f86fd92a4a299e5f806943aa480 Related-To: https://bugzilla.redhat.com/1133890 Signed-off-by: Greg Padgett <gpadg...@redhat.com> --- M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CommandBase.java M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/tasks/CommandExecutor.java 2 files changed, 6 insertions(+), 2 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/02/33002/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 314c50f..f9d966c 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 @@ -561,7 +561,10 @@ boolean exceptionOccurred = false; try { if (isEndSuccessfully()) { - setCommandStatus(CommandStatus.SUCCEEDED); + if (!hasTaskHandlers() || getExecutionIndex() == getTaskHandlers().size() - 1) { + // Allow doPolling() to trigger subsequent task handlers by calling endAction() + setCommandStatus(CommandStatus.SUCCEEDED); + } internalEndSuccessfully(); } else { setCommandStatus(CommandStatus.FAILED); diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/tasks/CommandExecutor.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/tasks/CommandExecutor.java index 913fe07..b314f5b 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/tasks/CommandExecutor.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/tasks/CommandExecutor.java @@ -94,9 +94,10 @@ getCallBackMethod(status), status.toString(), cmdId.toString()); - log.error(ex); + log.error(ex, ex); if (!CommandStatus.FAILED.equals(status)) { coco.updateCommandStatus(cmdId, CommandStatus.FAILED); + coco.retrieveCommand(cmdId).getParameters().setTaskGroupSuccess(false); } } -- To view, visit http://gerrit.ovirt.org/33002 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I85f54aea19774f86fd92a4a299e5f806943aa480 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Greg Padgett <gpadg...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches