Ravi Nori has uploaded a new change for review. Change subject: engine : placeholders of child commands aren't cleared on exception ......................................................................
engine : placeholders of child commands aren't cleared on exception A constructor not found error during endAction of RemoveImageCommand leaves async task place holder entries in the database. Change-Id: I457a1f9357fda9232a8757984d6936d9c977aa62 Bug-Url: https://bugzilla.redhat.com/1126204 Signed-off-by: Ravi Nori <[email protected]> --- M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/tasks/CoCoAsyncTaskHelper.java 1 file changed, 19 insertions(+), 2 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/37/31037/1 diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/tasks/CoCoAsyncTaskHelper.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/tasks/CoCoAsyncTaskHelper.java index 2008ac2..ecc09c3 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/tasks/CoCoAsyncTaskHelper.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/tasks/CoCoAsyncTaskHelper.java @@ -7,6 +7,8 @@ import org.ovirt.engine.core.bll.Backend; import org.ovirt.engine.core.bll.CommandBase; import org.ovirt.engine.core.bll.CommandsFactory; +import org.ovirt.engine.core.bll.context.CommandContext; +import org.ovirt.engine.core.bll.context.EngineContext; import org.ovirt.engine.core.bll.interfaces.BackendInternal; import org.ovirt.engine.core.bll.job.ExecutionContext; import org.ovirt.engine.core.bll.job.ExecutionHandler; @@ -312,11 +314,26 @@ AsyncTasks dbAsyncTask = task.getParameters().getDbAsyncTask(); VdcActionType actionType = getEndActionType(dbAsyncTask); VdcActionParametersBase parameters = dbAsyncTask.getActionParameters(); - CommandBase<?> command = CommandsFactory.createCommand(actionType, parameters); - command.getContext().withExecutionContext(context); + CommandBase<?> command = buildCommand(actionType, parameters, context, coco.getCommandStatus(dbAsyncTask.getCommandId())); return new DecoratedCommand(command).endAction(); } + private CommandBase<?> buildCommand(VdcActionType actionType, + VdcActionParametersBase parameters, + ExecutionContext executionContext, + CommandStatus cmdStatus) { + CommandBase<?> command; + CommandContext cmdContext = new CommandContext(new EngineContext()).withExecutionContext(executionContext); + if (CommandsFactory.hasConstructor(actionType, parameters, cmdContext)) { + command = CommandsFactory.createCommand(actionType, parameters, cmdContext); + } else { + command = CommandsFactory.createCommand(actionType, parameters); + command.getContext().withExecutionContext(executionContext); + } + command.setCommandStatus(cmdStatus, false); + return command; + } + private VdcActionType getEndActionType(AsyncTasks dbAsyncTask) { VdcActionType commandType = dbAsyncTask.getActionParameters().getCommandType(); if (!VdcActionType.Unknown.equals(commandType)) { -- To view, visit http://gerrit.ovirt.org/31037 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I457a1f9357fda9232a8757984d6936d9c977aa62 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Ravi Nori <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
