harikrishna-patnala commented on code in PR #7799:
URL: https://github.com/apache/cloudstack/pull/7799#discussion_r1281478165


##########
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:
   In my opinion, we better leave the user_defined flag as is to keep track of 
operator activities.



-- 
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

Reply via email to