Moti Asayag has posted comments on this change. Change subject: core: introduce context pattern ......................................................................
Patch Set 41: (11 comments) only minor comments - so code will look a bit smoother. I'm fine with fixing those in a later patch if this one is already verified. http://gerrit.ovirt.org/#/c/28829/41/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVdsCommand.java File backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVdsCommand.java: Line 190: installVdsParameters, Line 191: dupContext() Line 192: .withExecutionContext(installCtx) Line 193: .withLock(null) Line 194: .withCompensationContext(null)); s/.withLock(null)/.withoutLock() s/.withCompensationContext(null))/withoutCompensationContext()) Line 195: } Line 196: }); Line 197: ExecutionHandler.setAsyncJob(getExecutionContext(), true); Line 198: } http://gerrit.ovirt.org/#/c/28829/41/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AttachUserToVmFromPoolAndRunCommand.java File backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AttachUserToVmFromPoolAndRunCommand.java: Line 245: protected void endSuccessfully() { Line 246: if (getVm() != null) { Line 247: if (DbFacade.getInstance().getSnapshotDao().exists(getVm().getId(), SnapshotType.STATELESS)) { Line 248: setSucceeded(Backend.getInstance().endAction(VdcActionType.RunVm, Line 249: getParameters().getImagesParameters().get(0), dupContext().withoutLock().withExecutionContext(null)).getSucceeded()); s / .withExecutionContext(null) / .withoutExecutionContext() Line 250: Line 251: if (!getSucceeded()) { Line 252: log.warn("EndSuccessfully: endAction of RunVm failed, detaching user from Vm"); Line 253: detachUserFromVmFromPool(); // just in case. Line 273: @Override Line 274: protected void endWithFailure() { Line 275: setSucceeded(Backend.getInstance().endAction(VdcActionType.RunVm, Line 276: getParameters().getImagesParameters().get(0), Line 277: dupContext().withExecutionContext(null).withoutLock()).getSucceeded()); s / .withExecutionContext(null) / .withoutExecutionContext() Line 278: if (!getSucceeded()) { Line 279: log.warn("AttachUserToVmFromPoolAndRunCommand::EndWitFailure: endAction of RunVm Failed"); Line 280: } Line 281: detachUserFromVmFromPool(); http://gerrit.ovirt.org/#/c/28829/41/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CreateOvfStoresForStorageDomainCommand.java File backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CreateOvfStoresForStorageDomainCommand.java: Line 75: Line 76: getBackend().endAction(p.getCommandType(), Line 77: p, Line 78: getContext().clone().withoutCompensationContext().withoutExecutionContext()); Line 79: storageDomainOvfInfoDb.setStatus(StorageDomainOvfInfoStatus.OUTDATED); s/getContext().clone()/dupContext() Line 80: getStorageDomainOvfInfoDao().update(storageDomainOvfInfoDb); Line 81: } else { Line 82: getBackend().endAction(p.getCommandType(), Line 83: p, Line 81: } else { Line 82: getBackend().endAction(p.getCommandType(), Line 83: p, Line 84: getContext().clone().withoutCompensationContext().withoutExecutionContext().withoutLock()); Line 85: AuditLogDirector.log(this, AuditLogType.CREATE_OVF_STORE_FOR_STORAGE_DOMAIN_FAILED); same Line 86: } Line 87: } Line 88: Line 89: if (atleastOneSucceeded) { http://gerrit.ovirt.org/#/c/28829/41/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/DetachUserFromVmFromPoolCommand.java File backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/DetachUserFromVmFromPoolCommand.java: Line 60: // setting RestoreStatelessVm to run in new transaction so it could rollback internally if needed, Line 61: // but still not affect this command, in order to keep permissions changes even on restore failure Line 62: restoreParams.setTransactionScopeOption(TransactionScopeOption.RequiresNew); Line 63: runInternalAction(VdcActionType.RestoreStatelessVm, restoreParams, Line 64: getContext().withCompensationContext(null)); s/.withCompensationContext(null)/.withoutCompensationContext() Line 65: } Line 66: } Line 67: Line 68: @Override http://gerrit.ovirt.org/#/c/28829/41/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ExportVmTemplateCommand.java File backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ExportVmTemplateCommand.java: Line 190: for (VdcActionParametersBase p : getParameters().getImagesParameters()) { Line 191: p.setTaskGroupSuccess(getParameters().getTaskGroupSuccess()); Line 192: getBackend().endAction(getImagesActionType(), Line 193: p, Line 194: getContext().clone().withoutCompensationContext().withoutExecutionContext().withoutLock()); use dupContext() instead of getContext().clone() Line 195: } Line 196: } Line 197: Line 198: @Override http://gerrit.ovirt.org/#/c/28829/41/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ImportVmCommand.java File backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ImportVmCommand.java: Line 1168: for (VdcActionParametersBase p : getParameters().getImagesParameters()) { Line 1169: p.setTaskGroupSuccess(getParameters().getTaskGroupSuccess()); Line 1170: getBackend().endAction(getImagesActionType(), Line 1171: p, Line 1172: getContext().clone().withoutCompensationContext().withoutExecutionContext().withoutLock()); use dupContext() instead of getContext().clone() Line 1173: } Line 1174: } Line 1175: Line 1176: @Override http://gerrit.ovirt.org/#/c/28829/41/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ImportVmTemplateCommand.java File backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ImportVmTemplateCommand.java: Line 476: for (VdcActionParametersBase p : getParameters().getImagesParameters()) { Line 477: p.setTaskGroupSuccess(getParameters().getTaskGroupSuccess()); Line 478: getBackend().endAction(getImagesActionType(), Line 479: p, Line 480: getContext().clone().withoutCompensationContext().withoutExecutionContext().withoutLock()); use dupContext() instead of getContext().clone() Line 481: } Line 482: } Line 483: Line 484: @Override http://gerrit.ovirt.org/#/c/28829/41/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MoveOrCopyTemplateCommand.java File backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MoveOrCopyTemplateCommand.java: Line 335: protected void endActionOnAllImageGroups() { Line 336: for (VdcActionParametersBase p : getParameters().getImagesParameters()) { Line 337: getBackend().endAction(getImagesActionType(), Line 338: p, Line 339: getContext().clone().withoutCompensationContext().withoutExecutionContext().withoutLock()); use dupContext() instead of getContext().clone() Line 340: } Line 341: } Line 342: Line 343: protected VdcActionType getImagesActionType() { http://gerrit.ovirt.org/#/c/28829/41/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RunVmCommand.java File backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RunVmCommand.java: Line 905: protected void endSuccessfully() { Line 906: if (isStatelessSnapshotExistsForVm()) { Line 907: getBackend().endAction(VdcActionType.CreateAllSnapshotsFromVm, Line 908: buildCreateSnapshotParametersForEndAction(), Line 909: getContext().clone().withoutCompensationContext().withoutExecutionContext().withoutLock()); use dupContext() instead of getContext().clone() Line 910: Line 911: getParameters().setShouldBeLogged(false); Line 912: getParameters().setRunAsStateless(false); Line 913: -- To view, visit http://gerrit.ovirt.org/28829 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I310f5f77fff78b3232ee77fe63791425fd521516 Gerrit-PatchSet: 41 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Yair Zaslavsky <[email protected]> Gerrit-Reviewer: Alon Bar-Lev <[email protected]> Gerrit-Reviewer: Arik Hadas <[email protected]> Gerrit-Reviewer: Moti Asayag <[email protected]> Gerrit-Reviewer: Omer Frenkel <[email protected]> Gerrit-Reviewer: Oved Ourfali <[email protected]> Gerrit-Reviewer: Piotr Kliczewski <[email protected]> Gerrit-Reviewer: Ravi Nori <[email protected]> Gerrit-Reviewer: Roy Golan <[email protected]> Gerrit-Reviewer: Tal Nisan <[email protected]> Gerrit-Reviewer: Yair Zaslavsky <[email protected]> Gerrit-Reviewer: [email protected] Gerrit-Reviewer: oVirt Jenkins CI Server Gerrit-HasComments: Yes _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
