DaanHoogland commented on a change in pull request #4790:
URL: https://github.com/apache/cloudstack/pull/4790#discussion_r592529180



##########
File path: server/src/main/java/com/cloud/server/StatsCollector.java
##########
@@ -1599,10 +1621,21 @@ public String getConfigComponentName() {
 
     @Override
     public ConfigKey<?>[] getConfigKeys() {
-        return new ConfigKey<?>[] {vmDiskStatsInterval, 
vmDiskStatsIntervalMin, vmNetworkStatsInterval, vmNetworkStatsIntervalMin, 
StatsTimeout, statsOutputUri};
+        return new ConfigKey<?>[] {vmDiskStatsInterval, 
vmDiskStatsIntervalMin, vmNetworkStatsInterval, vmNetworkStatsIntervalMin, 
StatsTimeout, statsOutputUri, secondaryStorageCapacityThreshold};
     }
 
     public double getImageStoreCapacityThreshold() {
-        return _imageStoreCapacityThreshold;
+        double thresholdConfig = secondaryStorageCapacityThreshold.value();
+
+        if (thresholdConfig >= MIN_STORAGE_SECONDARY_CAPACITY_THRESHOLD && 
thresholdConfig <= MAX_STORAGE_SECONDARY_CAPACITY_THRESHOLD) {
+            return thresholdConfig;
+        }
+
+        s_logger.warn(String.format("Invalid [%s] configuration: value set 
[%s] is [%s]. Assuming %s as secondary storage capacity threshold.",
+                                    secondaryStorageCapacityThreshold.key(),
+                                    thresholdConfig,
+                                    thresholdConfig < 
MIN_STORAGE_SECONDARY_CAPACITY_THRESHOLD ? String.format("lower than '%s'", 
MIN_STORAGE_SECONDARY_CAPACITY_THRESHOLD) : String.format("bigger than '%s'", 
MAX_STORAGE_SECONDARY_CAPACITY_THRESHOLD),
+                                    MAX_STORAGE_SECONDARY_CAPACITY_THRESHOLD));
+        return MAX_STORAGE_SECONDARY_CAPACITY_THRESHOLD;

Review comment:
       sound like a plan




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to