Source:
private boolean UpdateStorageDomainsInDb() { boolean result = TransactionSupport.executeInNewTransaction(new TransactionMethod<Boolean>() { @Override public Boolean runInTransaction() { for (Guid storageDomainId : getParameters().getStorages()) { storage_domains storageDomain = DbFacade.getInstance().getStorageDomainDAO().get( storageDomainId); if (storageDomain != null) { storage_pool_iso_map mapFromDB = DbFacade.getInstance() .getStoragePoolIsoMapDAO() .get(new StoragePoolIsoMapId(storageDomain.getId(), getStoragePool().getId())); boolean existingInDb = mapFromDB != null; if (existingInDb) { getCompensationContext().snapshotEntity(mapFromDB); } if (getStoragePool().getcompatibility_version().compareTo(Version.v3_1) >= 0) { final storage_domain_static staticDomain = storageDomain.getStorageStaticData(); staticDomain.setStorageFormat(StorageFormatType.V3); getDbFacade().getStorageDomainStaticDAO().update(staticDomain); } storageDomain.setstorage_pool_id(getStoragePool().getId()); if (masterStorageDomain == null && storageDomain.getstorage_domain_type() == StorageDomainType.Data) { getStoragePool().setmaster_domain_version(getStoragePool().getmaster_domain_version() + 1); getCompensationContext().snapshotEntity(storageDomain.getStorageStaticData()); storageDomain.setstorage_domain_type(StorageDomainType.Master); DbFacade.getInstance().getStorageDomainStaticDAO().update(storageDomain.getStorageStaticData()); masterStorageDomain = storageDomain; updateStoragePoolInDiffTransaction(); } storageDomain.setstatus(StorageDomainStatus.Locked); if (existingInDb) { DbFacade.getInstance() .getStoragePoolIsoMapDAO() .update(storageDomain.getStoragePoolIsoMapData()); } else { DbFacade.getInstance() .getStoragePoolIsoMapDAO() .save(storageDomain.getStoragePoolIsoMapData()); getCompensationContext().snapshotNewEntity(storageDomain.getStoragePoolIsoMapData()); } } else { return false; } } getCompensationContext().stateChanged(); return true; } }); return result && masterStorageDomain != null; }

Target:
private boolean UpdateStorageDomainsInDb() { boolean result = TransactionSupport.executeInNewTransaction(new TransactionMethod<Boolean>() { @Override public Boolean runInTransaction() { for (Guid storageDomainId : getParameters().getStorages()) { storage_domains storageDomain = DbFacade.getInstance().getStorageDomainDAO().get( storageDomainId); if (storageDomain != null) { storage_pool_iso_map mapFromDB = DbFacade.getInstance() .getStoragePoolIsoMapDAO() .get(new StoragePoolIsoMapId(storageDomain.getId(), getStoragePool().getId())); boolean existingInDb = mapFromDB != null; if (existingInDb) { getCompensationContext().snapshotEntity(mapFromDB); } final storage_domain_static staticDomain = storageDomain.getStorageStaticData(); getCompensationContext().snapshotEntity(staticDomain); if (getStoragePool().getcompatibility_version().compareTo(Version.v3_1) >= 0 && staticDomain.getStorageFormat() != StorageFormatType.V3) { staticDomain.setStorageFormat(StorageFormatType.V3); getStorageDomainStaticDAO().update(staticDomain); } storageDomain.setstorage_pool_id(getStoragePool().getId()); if (masterStorageDomain == null && storageDomain.getstorage_domain_type() == StorageDomainType.Data) { getStoragePool().setmaster_domain_version(getStoragePool().getmaster_domain_version() + 1); storageDomain.setstorage_domain_type(StorageDomainType.Master); getStorageDomainStaticDAO().update(staticDomain); masterStorageDomain = storageDomain; updateStoragePoolInDiffTransaction(); } storageDomain.setstatus(StorageDomainStatus.Locked); if (existingInDb) { DbFacade.getInstance() .getStoragePoolIsoMapDAO() .update(storageDomain.getStoragePoolIsoMapData()); } else { DbFacade.getInstance() .getStoragePoolIsoMapDAO() .save(storageDomain.getStoragePoolIsoMapData()); getCompensationContext().snapshotNewEntity(storageDomain.getStoragePoolIsoMapData()); } } else { return false; } } getCompensationContext().stateChanged(); return true; } }); return result && masterStorageDomain != null; }