From 34836aaaa5585844027225dc67db98da2e465a1a Mon Sep 17 00:00:00 2001 From: prachi Date: Wed, 9 Mar 2011 13:46:07 -0800 Subject: [PATCH] Merging 2.1.8 fix to master : Bug 8801 - reserve some space for snapshots StoragePoolAllocators need to respect storage.capacity.threshold in allocations - this was broken after StatsCollector started maintaining the primary storage Stats separately Fixed allocator to refer the correct in-memory stats map. --- .../storage/allocator/AbstractStoragePoolAllocator.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/server/src/com/cloud/storage/allocator/AbstractStoragePoolAllocator.java b/server/src/com/cloud/storage/allocator/AbstractStoragePoolAllocator.java index c588668aecf..aad046aab9c 100644 --- a/server/src/com/cloud/storage/allocator/AbstractStoragePoolAllocator.java +++ b/server/src/com/cloud/storage/allocator/AbstractStoragePoolAllocator.java @@ -186,7 +186,10 @@ public abstract class AbstractStoragePoolAllocator extends AdapterBase implement // capacity check "storage.capacity.threshold" if (sc != null) { long totalSize = pool.getCapacityBytes(); - StorageStats stats = sc.getStorageStats(pool.getId()); + StorageStats stats = sc.getStoragePoolStats(pool.getId()); + if(stats == null){ + stats = sc.getStorageStats(pool.getId()); + } if (stats != null) { double usedPercentage = ((double)stats.getByteUsed() / (double)totalSize); if (s_logger.isDebugEnabled()) {