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-unsubscr...@cloudstack.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org