Liron Aravot has posted comments on this change. Change subject: core: add disk profile to disk's commands ......................................................................
Patch Set 13: (3 comments) http://gerrit.ovirt.org/#/c/29038/13/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/profiles/DiskProfileHelper.java File backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/profiles/DiskProfileHelper.java: Line 34: for (Entry<DiskImage, Guid> entry : map.entrySet()) { Line 35: DiskImage diskImage = entry.getKey(); Line 36: Guid storageDomainId = entry.getValue(); Line 37: DiskProfile diskProfile = null; Line 38: if (diskImage.getDiskProfileId() == null && storageDomainId != null) { // set disk profile if there's only 1 for SD. > please read the commit message. you didn't understand my comment imo this part should look like that: List<DiskProfile> diskProfilesList = storageDiskProfilesMap.get(storageDomainId); if (diskProfilesList == null) { diskProfilesList = getDiskProfileDao().getAllForStorageDomain(storageDomainId) storageDiskProfilesMap.put(storageDomainId, diskProfilesList); } Line 39: if (!storageDiskProfilesMap.containsKey(storageDomainId)) { Line 40: storageDiskProfilesMap.put(storageDomainId, Line 41: getDiskProfileDao().getAllForStorageDomain(storageDomainId)); Line 42: } Line 40: storageDiskProfilesMap.put(storageDomainId, Line 41: getDiskProfileDao().getAllForStorageDomain(storageDomainId)); Line 42: } Line 43: List<DiskProfile> diskProfilesList = storageDiskProfilesMap.get(storageDomainId); Line 44: if (diskProfilesList != null && diskProfilesList.size() == 1) { unneeded null checkk... Line 45: diskProfile = diskProfilesList.get(0); Line 46: diskImage.setDiskProfileId(diskProfile.getId()); Line 47: } Line 48: } else { Line 48: } else { Line 49: diskProfile = getDiskProfileDao().get(diskImage.getDiskProfileId()); Line 50: } Line 51: Line 52: ValidationResult result = new DiskProfileValidator(diskProfile).isStorageDomainValid(storageDomainId); > didn't get you. the execution of isStorageDomainValid is unneeded many times. Line 53: if (result != ValidationResult.VALID) { Line 54: return result; Line 55: } Line 56: } -- To view, visit http://gerrit.ovirt.org/29038 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ie7b6d977243cffc0bde772665ebaca47340075c6 Gerrit-PatchSet: 13 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Gilad Chaplik <gchap...@redhat.com> Gerrit-Reviewer: Allon Mureinik <amure...@redhat.com> Gerrit-Reviewer: Arik Hadas <aha...@redhat.com> Gerrit-Reviewer: Daniel Erez <de...@redhat.com> Gerrit-Reviewer: Doron Fediuck <dfedi...@redhat.com> Gerrit-Reviewer: Gilad Chaplik <gchap...@redhat.com> Gerrit-Reviewer: Liron Aravot <lara...@redhat.com> Gerrit-Reviewer: Tal Nisan <tni...@redhat.com> Gerrit-Reviewer: automat...@ovirt.org Gerrit-Reviewer: oVirt Jenkins CI Server Gerrit-HasComments: Yes _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches