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

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


The following commit(s) were added to refs/heads/main by this push:
     new dc17cf4  Prevent double counting storage pools (#5398)
dc17cf4 is described below

commit dc17cf4f39217d12850d560df39a5b6cb588e508
Author: DK101010 <[email protected]>
AuthorDate: Fri Sep 10 13:57:35 2021 +0200

    Prevent double counting storage pools (#5398)
    
    * Prevent double counting storage pools
    
    Currenly, getStoragePoolUsedStats fetch all pools
    undepended if a pool have a parent. Therefore as soon
    as a datastore cluster is used, the cluster and the storages it contains 
are calculated together
    The change fetch all storages without cluster and all datastore cluster
    
    * Update server/src/main/java/com/cloud/storage/StorageManagerImpl.java
    
    Co-authored-by: Abhishek Kumar <[email protected]>
    
    Co-authored-by: DK101010 <[email protected]>
    Co-authored-by: Abhishek Kumar <[email protected]>
---
 server/src/main/java/com/cloud/storage/StorageManagerImpl.java | 1 +
 1 file changed, 1 insertion(+)

diff --git a/server/src/main/java/com/cloud/storage/StorageManagerImpl.java 
b/server/src/main/java/com/cloud/storage/StorageManagerImpl.java
index 5507475..07e3668 100644
--- a/server/src/main/java/com/cloud/storage/StorageManagerImpl.java
+++ b/server/src/main/java/com/cloud/storage/StorageManagerImpl.java
@@ -2080,6 +2080,7 @@ public class StorageManagerImpl extends ManagerBase 
implements StorageManager, C
         if (poolId != null) {
             sc.addAnd("hostOrPoolId", SearchCriteria.Op.EQ, poolId);
         }
+        sc.addAnd("parent", SearchCriteria.Op.EQ, 0L);
         if (poolId != null) {
             pools.add(_storagePoolDao.findById(poolId));
         } else {

Reply via email to