Maor Lipchuk has posted comments on this change.
Change subject: core: use local TX in AddVm flow
......................................................................
Patch Set 2: (7 inline comments)
....................................................
File
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVmAndAttachToPoolCommand.java
Line 30: .getDiskInfoList(),
getParameters().getStorageDomainId());
Line 31: tempVar.setSessionId(getParameters().getSessionId());
Line 32: tempVar.setDontAttachToDefaultTag(true);
Line 33: returnValueFromAddVm =
Line 34:
Backend.getInstance().runInternalAction(VdcActionType.AddVmFromScratch,
We should pass the compensation context when calling this command
Line 35: tempVar,
Line 36:
ExecutionHandler.createDefaultContexForTasks(getExecutionContext()));
Line 37: } else {
Line 38: VmManagementParametersBase tempVar2 = new
VmManagementParametersBase(vmStatic);
Line 39: tempVar2.setSessionId(getParameters().getSessionId());
Line 40: tempVar2.setDontCheckTemplateImages(true);
Line 41: tempVar2.setDontAttachToDefaultTag(true);
Line 42: tempVar2.setDiskInfoDestinationMap(diskInfoDestinationMap);
Line 43: returnValueFromAddVm =
same here
Line 44:
Backend.getInstance().runInternalAction(VdcActionType.AddVm,
Line 45: tempVar2,
Line 46:
ExecutionHandler.createDefaultContexForTasks(getExecutionContext()));
Line 47: }
Line 50: if (vmAddedSuccessfully) {
Line 51:
getTaskIdList().addAll(returnValueFromAddVm.getInternalTaskIdList());
Line 52: AddVmToPoolParameters tempVar3 = new
AddVmToPoolParameters(getParameters().getPoolId(),
Line 53: vmStatic.getId());
Line 54: tempVar3.setShouldBeLogged(false);
same here
Line 55:
setSucceeded(Backend.getInstance().runInternalAction(VdcActionType.AddVmToPool,
tempVar3).getSucceeded());
Line 56: addVmPermission();
Line 57: }
Line 58: }
Line 51:
getTaskIdList().addAll(returnValueFromAddVm.getInternalTaskIdList());
Line 52: AddVmToPoolParameters tempVar3 = new
AddVmToPoolParameters(getParameters().getPoolId(),
Line 53: vmStatic.getId());
Line 54: tempVar3.setShouldBeLogged(false);
Line 55:
setSucceeded(Backend.getInstance().runInternalAction(VdcActionType.AddVmToPool,
tempVar3).getSucceeded());
Add compensation for permission here
Line 56: addVmPermission();
Line 57: }
Line 58: }
....................................................
File
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVmCommand.java
Line 69: import
org.ovirt.engine.core.utils.vmproperties.VmPropertiesUtils.ValidationError;
Line 70:
Line 71:
Line 72: @SuppressWarnings("serial")
Line 73: @DisableInPrepareMode
Need to add here also non transactive annotation
Line 74: @LockIdNameAttribute
Line 75: public class AddVmCommand<T extends VmManagementParametersBase>
extends VmManagementCommandBase<T>
Line 76: implements QuotaStorageDependent, QuotaVdsDependent {
Line 77:
Line 499: copyVmDevices();
Line 500: addDiskPermissions(newDiskImages);
Line 501: addVmPayload();
Line 502: updateSmartCardDevices();
Line 503: setActionReturnValue(getVm().getId());
Should add this new entities to the compensation
Line 504: setSucceeded(true);
Line 505: return null;
Line 506: }
Line 507: });
....................................................
File
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/utils/VmDeviceUtils.java
Line 824
Line 825
Line 826
Line 827
Line 828
Not related
--
To view, visit http://gerrit.ovirt.org/13805
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: If93240cca8bee4988f28c3de574b44c9db31e8f9
Gerrit-PatchSet: 2
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Roy Golan <[email protected]>
Gerrit-Reviewer: Daniel Erez <[email protected]>
Gerrit-Reviewer: Maor Lipchuk <[email protected]>
Gerrit-Reviewer: Michael Kublin <[email protected]>
Gerrit-Reviewer: Omer Frenkel <[email protected]>
Gerrit-Reviewer: Roy Golan <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches