You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by GitBox <gi...@apache.org> on 2022/04/11 08:27:45 UTC

[GitHub] [cloudstack] sureshanaparti commented on a diff in pull request #5797: [WIP] Improve global settings UI to be more intuitive/logical

sureshanaparti commented on code in PR #5797:
URL: https://github.com/apache/cloudstack/pull/5797#discussion_r847070357


##########
engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade41610to41700.java:
##########
@@ -83,4 +92,99 @@ public void updateSystemVmTemplates(Connection conn) {
             throw new CloudRuntimeException("Failed to find / register SystemVM template(s)");
         }
     }
+
+    private void updateConfigurationGroups(Connection conn) {
+        LOG.debug("Updating configuration groups");
+        try {
+            String stmt = "SELECT name FROM `cloud`.`configuration`";
+            PreparedStatement pstmt = conn.prepareStatement(stmt);
+            ResultSet rs = pstmt.executeQuery();
+
+            while (rs.next()) {
+                String configName = rs.getString(1);
+                if (StringUtils.isBlank(configName)) {
+                    continue;
+                }
+
+                // Get words from the dot notation in the configuration
+                String[] nameWords = configName.split("\\.");
+                if (nameWords.length <= 0) {
+                    continue;
+                }
+
+                for (int index = 0; index < nameWords.length; index++) {
+                    Pair<Long, Long> configGroupAndSubGroup = getConfigurationGroupAndSubGroup(conn, nameWords[index]);
+                    if (configGroupAndSubGroup.first() != 1 && configGroupAndSubGroup.second() != 1) {
+                        stmt = "UPDATE `cloud`.`configuration` SET group_id = ?, subgroup_id = ? WHERE name = ?";
+                        pstmt = conn.prepareStatement(stmt);
+                        pstmt.setLong(1, configGroupAndSubGroup.first());

Review Comment:
   _configGroupAndSubGroup_  is not null at all.



-- 
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-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org