From dc17cf4f39217d12850d560df39a5b6cb588e508 Mon Sep 17 00:00:00 2001 From: DK101010 <57522802+DK101010@users.noreply.github.com> Date: Fri, 10 Sep 2021 13:57:35 +0200 Subject: [PATCH] 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 Co-authored-by: DK101010 Co-authored-by: Abhishek Kumar --- 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 55074752747..07e36689d3c 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 {