Ravi Nori has uploaded a new change for review. Change subject: engine : VMs pool disappeared after creating a Sub Template version ......................................................................
engine : VMs pool disappeared after creating a Sub Template version VMs pool disappeared after creating a Sub Template version with exception constructor not found Change-Id: I7a4833182c3e9302308520a661e1318e366cb04d Bug-Url: https://bugzilla.redhat.com/1138419 Signed-off-by: Ravi Nori <rn...@redhat.com> --- 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/47/32947/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 2194fe6..e8b8ef18 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; @@ -330,11 +332,26 @@ AsyncTask 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(AsyncTask dbAsyncTask) { VdcActionType commandType = dbAsyncTask.getActionParameters().getCommandType(); if (!VdcActionType.Unknown.equals(commandType)) { -- To view, visit http://gerrit.ovirt.org/32947 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I7a4833182c3e9302308520a661e1318e366cb04d Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Ravi Nori <rn...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches