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



##########
File path: server/src/main/java/com/cloud/storage/StorageManagerImpl.java
##########
@@ -1834,6 +1836,42 @@ 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

Review comment:
       @sureshanaparti @DaanHoogland 
   I think I have expressed myself a little unclearly. Currently all custom 
attributes of the storage pools have a uuid without a separator (at least in 
the Vmware context). I think this is intentional even if I don't know why. The 
syncDatastoreClusterStoragePool method writes these uuids into the database 
without customising them.
   
   I understand and am with you. 
   
   I can modify the method to only store uuids with separators in the database. 
But this means that we still need to upgrade the database to match existing 
uuids of primary storages, otherwise new primary storages will be created. 
   
   However, I don't know of any sql that can convert a uuid without separators 
into a uuid with separators.
   
   




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