Skip to content

Commit 83fcba9

Browse files
committed
CLOUDSTACK-2946
CS-15158: Correcting the allocated size for local storage in listStoragePools
1 parent 215b638 commit 83fcba9

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

server/src/com/cloud/api/query/dao/StoragePoolJoinDaoImpl.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@
2222
import javax.ejb.Local;
2323
import javax.inject.Inject;
2424

25+
import com.cloud.capacity.Capacity;
2526
import org.apache.cloudstack.api.response.StoragePoolResponse;
27+
import org.apache.cloudstack.engine.subsystem.api.storage.ScopeType;
2628
import org.apache.log4j.Logger;
2729
import org.springframework.stereotype.Component;
2830

@@ -150,7 +152,8 @@ public StoragePoolResponse newStoragePoolForMigrationResponse(StoragePoolJoinVO
150152
}
151153

152154

153-
long allocatedSize = pool.getUsedCapacity() + pool.getReservedCapacity();
155+
short capacityType = pool.getScope() == ScopeType.HOST ? Capacity.CAPACITY_TYPE_LOCAL_STORAGE : Capacity.CAPACITY_TYPE_STORAGE_ALLOCATED;
156+
long allocatedSize = ApiDBUtils.getStorageCapacitybyPool(pool.getId(), capacityType);
154157
poolResponse.setDiskSizeTotal(pool.getCapacityBytes());
155158
poolResponse.setDiskSizeAllocated(allocatedSize);
156159

0 commit comments

Comments
 (0)