Updated Branches: refs/heads/master 215b638e8 -> 83fcba9ee
CLOUDSTACK-2946 CS-15158: Correcting the allocated size for local storage in listStoragePools Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/83fcba9e Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/83fcba9e Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/83fcba9e Branch: refs/heads/master Commit: 83fcba9ee64cdf4fe28e2c751fcfb2f83f9938d2 Parents: 215b638 Author: Nitin Mehta <[email protected]> Authored: Wed Jun 12 14:58:54 2013 +0530 Committer: Nitin Mehta <[email protected]> Committed: Wed Jun 12 14:58:54 2013 +0530 ---------------------------------------------------------------------- server/src/com/cloud/api/query/dao/StoragePoolJoinDaoImpl.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/83fcba9e/server/src/com/cloud/api/query/dao/StoragePoolJoinDaoImpl.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/api/query/dao/StoragePoolJoinDaoImpl.java b/server/src/com/cloud/api/query/dao/StoragePoolJoinDaoImpl.java index a6355ad..6d0cde1 100644 --- a/server/src/com/cloud/api/query/dao/StoragePoolJoinDaoImpl.java +++ b/server/src/com/cloud/api/query/dao/StoragePoolJoinDaoImpl.java @@ -22,7 +22,9 @@ import java.util.List; import javax.ejb.Local; import javax.inject.Inject; +import com.cloud.capacity.Capacity; import org.apache.cloudstack.api.response.StoragePoolResponse; +import org.apache.cloudstack.engine.subsystem.api.storage.ScopeType; import org.apache.log4j.Logger; import org.springframework.stereotype.Component; @@ -150,7 +152,8 @@ public class StoragePoolJoinDaoImpl extends GenericDaoBase<StoragePoolJoinVO, Lo } - long allocatedSize = pool.getUsedCapacity() + pool.getReservedCapacity(); + short capacityType = pool.getScope() == ScopeType.HOST ? Capacity.CAPACITY_TYPE_LOCAL_STORAGE : Capacity.CAPACITY_TYPE_STORAGE_ALLOCATED; + long allocatedSize = ApiDBUtils.getStorageCapacitybyPool(pool.getId(), capacityType); poolResponse.setDiskSizeTotal(pool.getCapacityBytes()); poolResponse.setDiskSizeAllocated(allocatedSize);
