CLOUDSTACK-2946

CS-15158: Correcting the allocated size for local storage in listStoragePools
This commit is contained in:
Nitin Mehta 2013-06-12 14:58:54 +05:30
parent 215b638e8e
commit 83fcba9ee6

View File

@ -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);