Liron Ar has posted comments on this change. Change subject: engine: Add compensation for storage pool in RemoveStoragePoolCommand ......................................................................
Patch Set 1: (1 comment) http://gerrit.ovirt.org/#/c/28671/1/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/RemoveStoragePoolCommand.java File backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/RemoveStoragePoolCommand.java: Line 89: MacPoolManager.getInstance().freeMacs(macsToRemove); Line 90: setSucceeded(true); Line 91: } Line 92: Line 93: private void removeDataCenter() { there are few issues here - 1. if the engine crash on line 96 - in that case the storage pool data won't be recorded in the database and it won't be recovered (becasue .stateChanged() wasn't executed) 2. if the execution fails after line 88 (free macs and later), we might still have the same bug - the reason for that is that the compensation context doesn't have an insertion order for it's saved entities, so it might attempt to re-insert records that have FK to the storage pool table before inserting again the storage pool. the solution here is that the removal of the storage pool should be done on the same transaction with resetting the compensation context as the last database operation here. private void removeDataCenter() { TransactionSupport.executeInNewTransaction....{ getStoragePoolDAO().remove(getStoragePool().getId()); getCompensationContext().reset); } } Line 94: getCompensationContext().snapshotEntity(getStoragePool()); Line 95: getStoragePoolDAO().remove(getStoragePool().getId()); Line 96: getCompensationContext().stateChanged(); Line 97: } -- To view, visit http://gerrit.ovirt.org/28671 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I491966e1901f5e792ebb57db65e1e076bebaddaf Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Yevgeny Zaspitsky <[email protected]> Gerrit-Reviewer: Liron Ar <[email protected]> Gerrit-Reviewer: Moti Asayag <[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
