DaanHoogland commented on code in PR #7799: URL: https://github.com/apache/cloudstack/pull/7799#discussion_r1281562987
########## engine/schema/src/main/java/com/cloud/upgrade/GuestOsMapper.java: ########## @@ -74,18 +74,19 @@ private long getGuestOsIdFromHypervisorMapping(GuestOSHypervisorMapping mapping) } public void addGuestOsAndHypervisorMappings(long categoryId, String displayName, List<GuestOSHypervisorMapping> mappings) { - if (!addGuestOs(categoryId, displayName)) { - LOG.warn("Couldn't add the guest OS with category id: " + categoryId + " and display name: " + displayName); - return; - } - - if (CollectionUtils.isEmpty(mappings)) { - return; - } - long guestOsId = getGuestOsId(categoryId, displayName); if (guestOsId == 0) { LOG.debug("No guest OS found with category id: " + categoryId + " and display name: " + displayName); + if (!addGuestOs(categoryId, displayName)) { + LOG.warn("Couldn't add the guest OS with category id: " + categoryId + " and display name: " + displayName); + return; + } + guestOsId = getGuestOsId(categoryId, displayName); + } else { + // TODO: update is_user_defined to false Review Comment: @harikrishna-patnala is there another place the deduplication is already taking place (see my pseudo code)? I do agree we should look at the user defined flag during deduplication. seems like the cleanest way. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@cloudstack.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org