DaanHoogland commented on a change in pull request #5382:
URL: https://github.com/apache/cloudstack/pull/5382#discussion_r720249450



##########
File path: 
engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade41520to41600.java
##########
@@ -65,6 +68,31 @@ public boolean supportsRollingUpgrade() {
     @Override
     public void performDataMigration(Connection conn) {
         generateUuidForExistingSshKeyPairs(conn);
+        fixWrongPoolUuid(conn);
+    }
+
+    public void fixWrongPoolUuid(Connection conn) {
+        LOG.debug("Replacement of faulty pool uuids");
+        try (PreparedStatement pstmt = conn.prepareStatement("SELECT id,uuid 
FROM storage_pool "
+                + "WHERE removed IS NULL;"); ResultSet rs = 
pstmt.executeQuery()) {
+            PreparedStatement updateStmt = conn.prepareStatement("update 
storage_pool set uuid = ? where id = ?");
+            while (rs.next()) {
+                if (!rs.getString(2).contains("-")) {

Review comment:
       not vital, /me nitpicking. I meant to move the contains check on the 
string to the sql to reduce the result set . i.e. `SELECT id,uuid FROM 
storage_pool "
                   + "WHERE removed IS NULL and uuid not LIKE '%-%-%' ` or some 
like it. please resolve if you don't feel like it, this should only be run once 
(on eache installation anyway.




-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to