Skip to content

Commit ff46636

Browse files
author
Dingane Hlaluku
committed
Add method to compute Imgae Store capacity from global setting
1 parent 42892ac commit ff46636

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

server/src/main/java/com/cloud/server/StatsCollector.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1364,6 +1364,14 @@ public boolean imageStoreHasEnoughCapacity(DataStore imageStore) {
13641364
return false;
13651365
}
13661366

1367+
public boolean imageStoreHasEnoughCapacity(DataStore imageStore, Double storeCapThreshold) {
1368+
StorageStats imageStoreStats = _storageStats.get(imageStore.getId());
1369+
if (imageStoreStats != null && (imageStoreStats.getByteUsed() / (imageStoreStats.getCapacityBytes() * 1.0)) <= storeCapThreshold) {
1370+
return true;
1371+
}
1372+
return false;
1373+
}
1374+
13671375
/**
13681376
* Sends VMs metrics to the configured graphite host.
13691377
*/

0 commit comments

Comments
 (0)