From c6649da6a82ca97f67f32fdb11148cc1f32e97cb Mon Sep 17 00:00:00 2001 From: Daniel Augusto Veronezi Salvador Date: Wed, 10 Mar 2021 14:55:14 +0000 Subject: [PATCH 1/7] Externalize secondary storage capacity threshold --- .../java/com/cloud/server/StatsCollector.java | 45 ++++++++++++++++--- 1 file changed, 39 insertions(+), 6 deletions(-) diff --git a/server/src/main/java/com/cloud/server/StatsCollector.java b/server/src/main/java/com/cloud/server/StatsCollector.java index d78a10607baa..4b20d79915ae 100644 --- a/server/src/main/java/com/cloud/server/StatsCollector.java +++ b/server/src/main/java/com/cloud/server/StatsCollector.java @@ -145,6 +145,7 @@ import com.cloud.vm.dao.VMInstanceDao; import static com.cloud.utils.NumbersUtil.toHumanReadableSize; +import org.apache.commons.io.FileUtils; /** * Provides real time stats for various agent resources up to x seconds @@ -204,6 +205,9 @@ public String toString() { private static final String INFLUXDB_HOST_MEASUREMENT = "host_stats"; private static final String INFLUXDB_VM_MEASUREMENT = "vm_stats"; + private static final double MIN_STORAGE_SECONDARY_CAPACITY_THRESHOLD = 0.00; + private static final double MAX_STORAGE_SECONDARY_CAPACITY_THRESHOLD = 1.00; + private static final ConfigKey vmDiskStatsInterval = new ConfigKey("Advanced", Integer.class, "vm.disk.stats.interval", "0", "Interval (in seconds) to report vm disk statistics. Vm disk statistics will be disabled if this is set to 0 or less than 0.", false); private static final ConfigKey vmDiskStatsIntervalMin = new ConfigKey("Advanced", Integer.class, "vm.disk.stats.interval.min", "300", @@ -219,6 +223,8 @@ public String toString() { private static final ConfigKey statsOutputUri = new ConfigKey("Advanced", String.class, "stats.output.uri", "", "URI to send StatsCollector statistics to. The collector is defined on the URI scheme. Example: graphite://graphite-hostaddress:port or influxdb://influxdb-hostaddress/dbname. Note that the port is optional, if not added the default port for the respective collector (graphite or influxdb) will be used. Additionally, the database name '/dbname' is also optional; default db name is 'cloudstack'. You must create and configure the database if using influxdb.", true); + private static final ConfigKey secondaryStorageCapacityThreshold = new ConfigKey("Advanced", Double.class, "secondary.storage.capacity.threshold", "0.90", + "Secondary storage capacity threshold (1 = 100%).", true); private static StatsCollector s_instance = null; @@ -296,8 +302,6 @@ public String toString() { private long volumeStatsInterval = -1L; private long autoScaleStatsInterval = -1L; - private double _imageStoreCapacityThreshold = 0.90; - private String externalStatsPrefix = ""; String externalStatsHost = null; int externalStatsPort = -1; @@ -1367,10 +1371,28 @@ public boolean imageStoreHasEnoughCapacity(DataStore imageStore) { if (!_storageStats.keySet().contains(imageStore.getId())) { // Stats not available for this store yet, can be a new store. Better to assume it has enough capacity? return true; } - StorageStats imageStoreStats = _storageStats.get(imageStore.getId()); - if (imageStoreStats != null && (imageStoreStats.getByteUsed() / (imageStoreStats.getCapacityBytes() * 1.0)) <= _imageStoreCapacityThreshold) { + + long imageStoreId = imageStore.getId(); + StorageStats imageStoreStats = _storageStats.get(imageStoreId); + + if (imageStoreStats == null) { + s_logger.debug(String.format("Stats for image store [%s] not found.", imageStoreId)); + return false; + } + + double totalCapacity = imageStoreStats.getCapacityBytes(); + double usedCapacity = imageStoreStats.getByteUsed(); + double threshold = getImageStoreCapacityThreshold(); + String readableTotalCapacity = FileUtils.byteCountToDisplaySize((long) totalCapacity); + String readableUsedCapacity = FileUtils.byteCountToDisplaySize((long) usedCapacity); + + s_logger.debug(String.format("Verifying image storage [%s]. Capacity: total=[%s], used=[%s], threshold=[%s%%].", imageStoreId, readableTotalCapacity, readableUsedCapacity, threshold * 100)); + + if (usedCapacity / totalCapacity <= threshold) { return true; } + + s_logger.warn(String.format("Image storage [%s] has not enough capacity. Capacity: total=[%s], used=[%s], threshold=[%s%%].", imageStoreId,readableTotalCapacity, readableUsedCapacity, threshold * 100)); return false; } @@ -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; } } From 3ec2ed61e18a4f4272fcb89fc1581fd071dea2a1 Mon Sep 17 00:00:00 2001 From: Daniel Augusto Veronezi Salvador Date: Thu, 11 Mar 2021 15:22:48 -0300 Subject: [PATCH 2/7] Use default value as threshold when config value is lower than 0.0 --- .../java/com/cloud/server/StatsCollector.java | 26 ++++++++++++++----- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/server/src/main/java/com/cloud/server/StatsCollector.java b/server/src/main/java/com/cloud/server/StatsCollector.java index 4b20d79915ae..1b4414bf1c75 100644 --- a/server/src/main/java/com/cloud/server/StatsCollector.java +++ b/server/src/main/java/com/cloud/server/StatsCollector.java @@ -146,6 +146,7 @@ import static com.cloud.utils.NumbersUtil.toHumanReadableSize; import org.apache.commons.io.FileUtils; +import org.apache.commons.lang3.math.NumberUtils; /** * Provides real time stats for various agent resources up to x seconds @@ -1625,16 +1626,27 @@ public ConfigKey[] getConfigKeys() { } public double getImageStoreCapacityThreshold() { - double thresholdConfig = secondaryStorageCapacityThreshold.value(); + double thresholdConfigValue = secondaryStorageCapacityThreshold.value(); + double thresholdConfigDefaultValue = NumberUtils.toDouble(secondaryStorageCapacityThreshold.defaultValue()); + String thresholdConfigKey = secondaryStorageCapacityThreshold.key(); - if (thresholdConfig >= MIN_STORAGE_SECONDARY_CAPACITY_THRESHOLD && thresholdConfig <= MAX_STORAGE_SECONDARY_CAPACITY_THRESHOLD) { - return thresholdConfig; + if (thresholdConfigValue >= MIN_STORAGE_SECONDARY_CAPACITY_THRESHOLD && thresholdConfigValue <= MAX_STORAGE_SECONDARY_CAPACITY_THRESHOLD) { + return thresholdConfigValue; } - 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), + if (thresholdConfigValue < MIN_STORAGE_SECONDARY_CAPACITY_THRESHOLD) { + s_logger.warn(String.format("Invalid [%s] configuration: value set [%s] is lower than '%s'. Assuming '%s', default value, as secondary storage capacity threshold.", + thresholdConfigKey, + thresholdConfigValue, + MIN_STORAGE_SECONDARY_CAPACITY_THRESHOLD, + thresholdConfigDefaultValue)); + return thresholdConfigDefaultValue; + } + + s_logger.warn(String.format("Invalid [%s] configuration: value set [%s] is bigger than '%s'. Assuming '%s', top limit, as secondary storage capacity threshold.", + thresholdConfigKey, + thresholdConfigValue, + MAX_STORAGE_SECONDARY_CAPACITY_THRESHOLD, MAX_STORAGE_SECONDARY_CAPACITY_THRESHOLD)); return MAX_STORAGE_SECONDARY_CAPACITY_THRESHOLD; } From da074f0de5b37f1c55158eb49072601e7e1cceed Mon Sep 17 00:00:00 2001 From: Daniel Augusto Veronezi Salvador Date: Mon, 31 May 2021 11:38:18 -0300 Subject: [PATCH 3/7] Move config to CapacityManager --- .../main/java/com/cloud/capacity/CapacityManager.java | 3 +++ .../java/com/cloud/capacity/CapacityManagerImpl.java | 2 +- .../main/java/com/cloud/server/StatsCollector.java | 11 +++++------ 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/engine/components-api/src/main/java/com/cloud/capacity/CapacityManager.java b/engine/components-api/src/main/java/com/cloud/capacity/CapacityManager.java index d23002b298b5..ba1235a18751 100644 --- a/engine/components-api/src/main/java/com/cloud/capacity/CapacityManager.java +++ b/engine/components-api/src/main/java/com/cloud/capacity/CapacityManager.java @@ -87,6 +87,9 @@ public interface CapacityManager { ConfigKey.Scope.ImageStore, null); + static final ConfigKey secondaryStorageCapacityThreshold = new ConfigKey("Advanced", Double.class, "secondary.storage.capacity.threshold", "0.90", + "Secondary storage capacity threshold (1 = 100%).", true); + public boolean releaseVmCapacity(VirtualMachine vm, boolean moveFromReserved, boolean moveToReservered, Long hostId); void allocateVmCapacity(VirtualMachine vm, boolean fromLastHost); diff --git a/server/src/main/java/com/cloud/capacity/CapacityManagerImpl.java b/server/src/main/java/com/cloud/capacity/CapacityManagerImpl.java index 543c9772d7c6..c24b7009d716 100644 --- a/server/src/main/java/com/cloud/capacity/CapacityManagerImpl.java +++ b/server/src/main/java/com/cloud/capacity/CapacityManagerImpl.java @@ -1233,6 +1233,6 @@ public String getConfigComponentName() { @Override public ConfigKey[] getConfigKeys() { return new ConfigKey[] {CpuOverprovisioningFactor, MemOverprovisioningFactor, StorageCapacityDisableThreshold, StorageOverprovisioningFactor, - StorageAllocatedCapacityDisableThreshold, StorageOperationsExcludeCluster, VmwareCreateCloneFull, ImageStoreNFSVersion}; + StorageAllocatedCapacityDisableThreshold, StorageOperationsExcludeCluster, VmwareCreateCloneFull, ImageStoreNFSVersion, secondaryStorageCapacityThreshold}; } } diff --git a/server/src/main/java/com/cloud/server/StatsCollector.java b/server/src/main/java/com/cloud/server/StatsCollector.java index 1b4414bf1c75..81f9e162475b 100644 --- a/server/src/main/java/com/cloud/server/StatsCollector.java +++ b/server/src/main/java/com/cloud/server/StatsCollector.java @@ -70,6 +70,7 @@ import com.cloud.agent.api.VmNetworkStatsEntry; import com.cloud.agent.api.VmStatsEntry; import com.cloud.agent.api.VolumeStatsEntry; +import com.cloud.capacity.CapacityManager; import com.cloud.cluster.ManagementServerHostVO; import com.cloud.cluster.dao.ManagementServerHostDao; import com.cloud.dc.Vlan.VlanType; @@ -224,8 +225,6 @@ public String toString() { private static final ConfigKey statsOutputUri = new ConfigKey("Advanced", String.class, "stats.output.uri", "", "URI to send StatsCollector statistics to. The collector is defined on the URI scheme. Example: graphite://graphite-hostaddress:port or influxdb://influxdb-hostaddress/dbname. Note that the port is optional, if not added the default port for the respective collector (graphite or influxdb) will be used. Additionally, the database name '/dbname' is also optional; default db name is 'cloudstack'. You must create and configure the database if using influxdb.", true); - private static final ConfigKey secondaryStorageCapacityThreshold = new ConfigKey("Advanced", Double.class, "secondary.storage.capacity.threshold", "0.90", - "Secondary storage capacity threshold (1 = 100%).", true); private static StatsCollector s_instance = null; @@ -1622,13 +1621,13 @@ public String getConfigComponentName() { @Override public ConfigKey[] getConfigKeys() { - return new ConfigKey[] {vmDiskStatsInterval, vmDiskStatsIntervalMin, vmNetworkStatsInterval, vmNetworkStatsIntervalMin, StatsTimeout, statsOutputUri, secondaryStorageCapacityThreshold}; + return new ConfigKey[] {vmDiskStatsInterval, vmDiskStatsIntervalMin, vmNetworkStatsInterval, vmNetworkStatsIntervalMin, StatsTimeout, statsOutputUri}; } public double getImageStoreCapacityThreshold() { - double thresholdConfigValue = secondaryStorageCapacityThreshold.value(); - double thresholdConfigDefaultValue = NumberUtils.toDouble(secondaryStorageCapacityThreshold.defaultValue()); - String thresholdConfigKey = secondaryStorageCapacityThreshold.key(); + double thresholdConfigValue = CapacityManager.secondaryStorageCapacityThreshold.value(); + double thresholdConfigDefaultValue = NumberUtils.toDouble(CapacityManager.secondaryStorageCapacityThreshold.defaultValue()); + String thresholdConfigKey = CapacityManager.secondaryStorageCapacityThreshold.key(); if (thresholdConfigValue >= MIN_STORAGE_SECONDARY_CAPACITY_THRESHOLD && thresholdConfigValue <= MAX_STORAGE_SECONDARY_CAPACITY_THRESHOLD) { return thresholdConfigValue; From 7330f2afb550e3d2fcf9f888e7d7acf8b93e66f2 Mon Sep 17 00:00:00 2001 From: Daniel Augusto Veronezi Salvador Date: Mon, 31 May 2021 12:30:11 -0300 Subject: [PATCH 4/7] Validate config in CapacityManagerImpl --- .../com/cloud/capacity/CapacityManager.java | 2 +- .../cloud/capacity/CapacityManagerImpl.java | 2 +- .../ConfigurationManagerImpl.java | 1 + .../java/com/cloud/server/StatsCollector.java | 27 +------------------ 4 files changed, 4 insertions(+), 28 deletions(-) diff --git a/engine/components-api/src/main/java/com/cloud/capacity/CapacityManager.java b/engine/components-api/src/main/java/com/cloud/capacity/CapacityManager.java index ba1235a18751..b04dce3b597a 100644 --- a/engine/components-api/src/main/java/com/cloud/capacity/CapacityManager.java +++ b/engine/components-api/src/main/java/com/cloud/capacity/CapacityManager.java @@ -87,7 +87,7 @@ public interface CapacityManager { ConfigKey.Scope.ImageStore, null); - static final ConfigKey secondaryStorageCapacityThreshold = new ConfigKey("Advanced", Double.class, "secondary.storage.capacity.threshold", "0.90", + static final ConfigKey SecondaryStorageCapacityThreshold = new ConfigKey("Advanced", Float.class, "secondary.storage.capacity.threshold", "0.90", "Secondary storage capacity threshold (1 = 100%).", true); public boolean releaseVmCapacity(VirtualMachine vm, boolean moveFromReserved, boolean moveToReservered, Long hostId); diff --git a/server/src/main/java/com/cloud/capacity/CapacityManagerImpl.java b/server/src/main/java/com/cloud/capacity/CapacityManagerImpl.java index c24b7009d716..4fc81e85bfd7 100644 --- a/server/src/main/java/com/cloud/capacity/CapacityManagerImpl.java +++ b/server/src/main/java/com/cloud/capacity/CapacityManagerImpl.java @@ -1233,6 +1233,6 @@ public String getConfigComponentName() { @Override public ConfigKey[] getConfigKeys() { return new ConfigKey[] {CpuOverprovisioningFactor, MemOverprovisioningFactor, StorageCapacityDisableThreshold, StorageOverprovisioningFactor, - StorageAllocatedCapacityDisableThreshold, StorageOperationsExcludeCluster, VmwareCreateCloneFull, ImageStoreNFSVersion, secondaryStorageCapacityThreshold}; + StorageAllocatedCapacityDisableThreshold, StorageOperationsExcludeCluster, VmwareCreateCloneFull, ImageStoreNFSVersion, SecondaryStorageCapacityThreshold}; } } diff --git a/server/src/main/java/com/cloud/configuration/ConfigurationManagerImpl.java b/server/src/main/java/com/cloud/configuration/ConfigurationManagerImpl.java index f5de35af3ed2..1e9876641818 100755 --- a/server/src/main/java/com/cloud/configuration/ConfigurationManagerImpl.java +++ b/server/src/main/java/com/cloud/configuration/ConfigurationManagerImpl.java @@ -494,6 +494,7 @@ private void weightBasedParametersForValidation() { weightBasedParametersForValidation.add(DeploymentClusterPlanner.ClusterMemoryCapacityDisableThreshold.key()); weightBasedParametersForValidation.add(Config.AgentLoadThreshold.key()); weightBasedParametersForValidation.add(Config.VmUserDispersionWeight.key()); + weightBasedParametersForValidation.add(CapacityManager.SecondaryStorageCapacityThreshold.key()); } diff --git a/server/src/main/java/com/cloud/server/StatsCollector.java b/server/src/main/java/com/cloud/server/StatsCollector.java index 81f9e162475b..fe14008c2325 100644 --- a/server/src/main/java/com/cloud/server/StatsCollector.java +++ b/server/src/main/java/com/cloud/server/StatsCollector.java @@ -207,9 +207,6 @@ public String toString() { private static final String INFLUXDB_HOST_MEASUREMENT = "host_stats"; private static final String INFLUXDB_VM_MEASUREMENT = "vm_stats"; - private static final double MIN_STORAGE_SECONDARY_CAPACITY_THRESHOLD = 0.00; - private static final double MAX_STORAGE_SECONDARY_CAPACITY_THRESHOLD = 1.00; - private static final ConfigKey vmDiskStatsInterval = new ConfigKey("Advanced", Integer.class, "vm.disk.stats.interval", "0", "Interval (in seconds) to report vm disk statistics. Vm disk statistics will be disabled if this is set to 0 or less than 0.", false); private static final ConfigKey vmDiskStatsIntervalMin = new ConfigKey("Advanced", Integer.class, "vm.disk.stats.interval.min", "300", @@ -1625,28 +1622,6 @@ public ConfigKey[] getConfigKeys() { } public double getImageStoreCapacityThreshold() { - double thresholdConfigValue = CapacityManager.secondaryStorageCapacityThreshold.value(); - double thresholdConfigDefaultValue = NumberUtils.toDouble(CapacityManager.secondaryStorageCapacityThreshold.defaultValue()); - String thresholdConfigKey = CapacityManager.secondaryStorageCapacityThreshold.key(); - - if (thresholdConfigValue >= MIN_STORAGE_SECONDARY_CAPACITY_THRESHOLD && thresholdConfigValue <= MAX_STORAGE_SECONDARY_CAPACITY_THRESHOLD) { - return thresholdConfigValue; - } - - if (thresholdConfigValue < MIN_STORAGE_SECONDARY_CAPACITY_THRESHOLD) { - s_logger.warn(String.format("Invalid [%s] configuration: value set [%s] is lower than '%s'. Assuming '%s', default value, as secondary storage capacity threshold.", - thresholdConfigKey, - thresholdConfigValue, - MIN_STORAGE_SECONDARY_CAPACITY_THRESHOLD, - thresholdConfigDefaultValue)); - return thresholdConfigDefaultValue; - } - - s_logger.warn(String.format("Invalid [%s] configuration: value set [%s] is bigger than '%s'. Assuming '%s', top limit, as secondary storage capacity threshold.", - thresholdConfigKey, - thresholdConfigValue, - MAX_STORAGE_SECONDARY_CAPACITY_THRESHOLD, - MAX_STORAGE_SECONDARY_CAPACITY_THRESHOLD)); - return MAX_STORAGE_SECONDARY_CAPACITY_THRESHOLD; + return CapacityManager.SecondaryStorageCapacityThreshold.value(); } } From a0fabd63a748ed5590ed93a9eeaab65ee23122b0 Mon Sep 17 00:00:00 2001 From: Daniel Augusto Veronezi Salvador Date: Mon, 31 May 2021 12:32:16 -0300 Subject: [PATCH 5/7] Use config in StorageOrchestrator --- .../cloudstack/engine/orchestration/StorageOrchestrator.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/StorageOrchestrator.java b/engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/StorageOrchestrator.java index ab53fd464880..2046adafb1d4 100644 --- a/engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/StorageOrchestrator.java +++ b/engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/StorageOrchestrator.java @@ -17,6 +17,7 @@ package org.apache.cloudstack.engine.orchestration; +import com.cloud.capacity.CapacityManager; import java.util.ArrayList; import java.util.Date; import java.util.HashMap; @@ -101,7 +102,6 @@ public class StorageOrchestrator extends ManagerBase implements StorageOrchestra true, ConfigKey.Scope.Global); Integer numConcurrentCopyTasksPerSSVM = 2; - private double imageStoreCapacityThreshold = 0.90; @Override public String getConfigComponentName() { @@ -404,7 +404,7 @@ private boolean shouldMigrate(DataObject chosenFile, Long srcDatastoreId, Long d private boolean storageCapacityBelowThreshold(Map> storageCapacities, Long destStoreId) { Pair imageStoreCapacity = storageCapacities.get(destStoreId); long usedCapacity = imageStoreCapacity.second() - imageStoreCapacity.first(); - if (imageStoreCapacity != null && (usedCapacity / (imageStoreCapacity.second() * 1.0)) <= imageStoreCapacityThreshold) { + if (imageStoreCapacity != null && (usedCapacity / (imageStoreCapacity.second() * 1.0)) <= CapacityManager.SecondaryStorageCapacityThreshold.value()) { s_logger.debug("image store: " + destStoreId + " has sufficient capacity to proceed with migration of file"); return true; } From 69a7de328138308f8d986af63b61f15fe682c917 Mon Sep 17 00:00:00 2001 From: Daniel Augusto Veronezi Salvador Date: Mon, 31 May 2021 12:33:48 -0300 Subject: [PATCH 6/7] Change config description --- .../src/main/java/com/cloud/capacity/CapacityManager.java | 2 +- server/src/main/java/com/cloud/server/StatsCollector.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/engine/components-api/src/main/java/com/cloud/capacity/CapacityManager.java b/engine/components-api/src/main/java/com/cloud/capacity/CapacityManager.java index b04dce3b597a..90aec5d610ab 100644 --- a/engine/components-api/src/main/java/com/cloud/capacity/CapacityManager.java +++ b/engine/components-api/src/main/java/com/cloud/capacity/CapacityManager.java @@ -88,7 +88,7 @@ public interface CapacityManager { null); static final ConfigKey SecondaryStorageCapacityThreshold = new ConfigKey("Advanced", Float.class, "secondary.storage.capacity.threshold", "0.90", - "Secondary storage capacity threshold (1 = 100%).", true); + "Percentage (as a value between 0 and 1) of secondary storage capacity threshold.", true); public boolean releaseVmCapacity(VirtualMachine vm, boolean moveFromReserved, boolean moveToReservered, Long hostId); diff --git a/server/src/main/java/com/cloud/server/StatsCollector.java b/server/src/main/java/com/cloud/server/StatsCollector.java index fe14008c2325..93bcb02baaff 100644 --- a/server/src/main/java/com/cloud/server/StatsCollector.java +++ b/server/src/main/java/com/cloud/server/StatsCollector.java @@ -1389,7 +1389,7 @@ public boolean imageStoreHasEnoughCapacity(DataStore imageStore) { return true; } - s_logger.warn(String.format("Image storage [%s] has not enough capacity. Capacity: total=[%s], used=[%s], threshold=[%s%%].", imageStoreId,readableTotalCapacity, readableUsedCapacity, threshold * 100)); + s_logger.warn(String.format("Image storage [%s] has not enough capacity. Capacity: total=[%s], used=[%s], threshold=[%s%%].", imageStoreId, readableTotalCapacity, readableUsedCapacity, threshold * 100)); return false; } From db8362d3de9043572e26e6917faf37c4b7b6f5ff Mon Sep 17 00:00:00 2001 From: Daniel Augusto Veronezi Salvador Date: Mon, 7 Jun 2021 10:23:18 -0300 Subject: [PATCH 7/7] Remove unused import --- server/src/main/java/com/cloud/server/StatsCollector.java | 1 - 1 file changed, 1 deletion(-) diff --git a/server/src/main/java/com/cloud/server/StatsCollector.java b/server/src/main/java/com/cloud/server/StatsCollector.java index 93bcb02baaff..8883fa2fd3c4 100644 --- a/server/src/main/java/com/cloud/server/StatsCollector.java +++ b/server/src/main/java/com/cloud/server/StatsCollector.java @@ -147,7 +147,6 @@ import static com.cloud.utils.NumbersUtil.toHumanReadableSize; import org.apache.commons.io.FileUtils; -import org.apache.commons.lang3.math.NumberUtils; /** * Provides real time stats for various agent resources up to x seconds