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 2021/08/27 12:58:43 UTC

[GitHub] [cloudstack] DK101010 commented on a change in pull request #5382: fix mismatching between db uuids and custom attributes uuids

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



##########
File path: server/src/main/java/com/cloud/storage/StorageManagerImpl.java
##########
@@ -1834,6 +1836,43 @@ public void syncDatastoreClusterStoragePool(long datastoreClusterPoolId, List<Mo
         handleRemoveChildStoragePoolFromDatastoreCluster(childDatastoreUUIDs);
     }
 
+    /**
+     * fixed mismatching between db uuids and and custom
+     * attribute uuids
+     *
+     * To different formats of uuids exists
+     * 1. xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
+     * 2. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+     * @param uuid of existing pool
+     * @return existing pull or null otherwise
+     */
+    private StoragePoolVO getExistingPoolByUuid(String uuid){
+        StoragePoolVO storagePool = _storagePoolDao.findByUuid(uuid);
+        if(storagePool != null){
+            return storagePool;
+        }
+
+        //this case is unlikely (DB uuid without separators), but safety first
+        if(uuid.contains("-")){
+            uuid = uuid.replaceAll("-", "");
+            storagePool = _storagePoolDao.findByUuid(uuid);
+            if(storagePool != null){
+                storagePool.setUuid(uuid);

Review comment:
       Hi @DaanHoogland, you are right. That was my bad. I will change this.   




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