Liron Ar has uploaded a new change for review. Change subject: core: proceedStorageDomainTreatmentByDomainType - proper compensation ......................................................................
core: proceedStorageDomainTreatmentByDomainType - proper compensation proceedStorageDomainTreatmentByDomainType() method updates different properties of the storage domain, to use the compensation mechanisam in case of failure the storage domain's static data before the updates was saved in the compensation context. The snapshotEntity() method used for saving the static in the compensation context has documentation stating the in case that the entity was deleted/updated it would be restored to it's state as saved, which means that if it was deleted, the entity would be re-inserted. ForceRemoveStorageDomainCommand is an engine command to remove a domain from the database forcibly at the user risk, this command can run parallely to the ReconstructMasterDomainCommand (as this command is being executed without "BLL" locks) which executes the proceedStorageDomainTreatmentByDomainType() method. This can cause to an issue - if the domain is removed by the removal command, the compensation used in the reconstruct command might re-insert domain related records to the db. As there are many issues involved with the reconstruct command and we are on the way to get rid of it completly, rather than adding locks the fix here is to use the snapshotEntityUpdated() method which is more correct in that case (as we only update the entity) and will remove the possibility of mistkenly re-inserting the data. Change-Id: I9ec99cf5e567fe9820e4028a886372d73d5c1d6f Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=969026 Signed-off-by: Liron Aravot <[email protected]> --- M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/DeactivateStorageDomainCommand.java 1 file changed, 2 insertions(+), 2 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/32/25232/1 diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/DeactivateStorageDomainCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/DeactivateStorageDomainCommand.java index 58f756d..10a1f0f 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/DeactivateStorageDomainCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/DeactivateStorageDomainCommand.java @@ -312,7 +312,7 @@ @Override public Object runInTransaction() { StoragePoolIsoMap newMasterMap = newMaster.getStoragePoolIsoMapData(); - getCompensationContext().snapshotEntity(newMaster.getStorageStaticData()); + getCompensationContext().snapshotEntityUpdated(newMaster.getStorageStaticData()); newMaster.setStorageDomainType(StorageDomainType.Master); if (!duringReconstruct) { newMasterMap.setStatus(StorageDomainStatus.Unknown); @@ -321,7 +321,7 @@ getStoragePoolIsoMapDAO().updateStatus(newMasterMap.getId(), newMasterMap.getStatus()); } updateStorageDomainStaticData(newMaster.getStorageStaticData()); - getCompensationContext().snapshotEntity(getStorageDomain().getStorageStaticData()); + getCompensationContext().snapshotEntityUpdated(getStorageDomain().getStorageStaticData()); getStorageDomain().setStorageDomainType(StorageDomainType.Data); updateStorageDomainStaticData(getStorageDomain().getStorageStaticData()); getCompensationContext().stateChanged(); -- To view, visit http://gerrit.ovirt.org/25232 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I9ec99cf5e567fe9820e4028a886372d73d5c1d6f Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Liron Ar <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
