This is an automated email from the ASF dual-hosted git repository.

shwstppr pushed a commit to branch 4.17
in repository https://gitbox.apache.org/repos/asf/cloudstack.git


The following commit(s) were added to refs/heads/4.17 by this push:
     new 1fd1f0626a0 Fix SQL query for uuid wrong format (#6654)
1fd1f0626a0 is described below

commit 1fd1f0626a020fa26d4f23b192ff339a003ef733
Author: Nicolas Vazquez <[email protected]>
AuthorDate: Fri Aug 19 09:57:11 2022 -0300

    Fix SQL query for uuid wrong format (#6654)
    
    Fixes: #6652
---
 .../src/main/java/com/cloud/upgrade/dao/Upgrade41610to41700.java | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git 
a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade41610to41700.java 
b/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade41610to41700.java
index be1e42cb5d9..6b41ba42b22 100644
--- a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade41610to41700.java
+++ b/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade41610to41700.java
@@ -61,7 +61,7 @@ public class Upgrade41610to41700 implements DbUpgrade, 
DbUpgradeSystemVmTemplate
 
     @Override
     public void performDataMigration(Connection conn) {
-        fixWrongPoolUuid(conn);
+        fixWrongDatastoreClusterPoolUuid(conn);
     }
 
     @Override
@@ -90,10 +90,11 @@ public class Upgrade41610to41700 implements DbUpgrade, 
DbUpgradeSystemVmTemplate
         }
     }
 
-    public void fixWrongPoolUuid(Connection conn) {
-        LOG.debug("Replacement of faulty pool uuids");
+    public void fixWrongDatastoreClusterPoolUuid(Connection conn) {
+        LOG.debug("Replacement of faulty pool uuids on datastorecluster");
         try (PreparedStatement pstmt = conn.prepareStatement("SELECT id,uuid 
FROM storage_pool "
-                + "WHERE uuid NOT LIKE \"%-%-%-%\" AND removed IS NULL;"); 
ResultSet rs = pstmt.executeQuery()) {
+                + "WHERE uuid NOT LIKE \"%-%-%-%\" AND removed IS NULL "
+                + "AND pool_type = 'DatastoreCluster';"); ResultSet rs = 
pstmt.executeQuery()) {
             PreparedStatement updateStmt = conn.prepareStatement("update 
storage_pool set uuid = ? where id = ?");
             while (rs.next()) {
                     UUID poolUuid = new UUID(

Reply via email to