mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
bug 6103: Made "capacity.skipcounting.hours" to apply only for Stopped vms. Introduced "capacity.skipcounting.destroyed.hours" config value that is used for vms in Destroyed state
status 6103: resolved fixed
This commit is contained in:
parent
c48bd7cf63
commit
9228088ce3
@ -78,6 +78,7 @@ public class UserConcentratedAllocator implements PodAllocator {
|
||||
|
||||
Random _rand = new Random(System.currentTimeMillis());
|
||||
private int _hoursToSkipStoppedVMs = 24;
|
||||
private int _hoursToSkipDestroyedVMs = 0;
|
||||
|
||||
private int _secStorageVmRamSize = 1024;
|
||||
private int _proxyRamSize = 256;
|
||||
@ -202,15 +203,20 @@ public class UserConcentratedAllocator implements PodAllocator {
|
||||
return true;
|
||||
|
||||
if(vm.getState() == State.Stopped || vm.getState() == State.Destroyed) {
|
||||
// for stopped/Destroyed VMs, we will skip counting it if it hasn't been used for a while
|
||||
// for Stopped/Destroyed VMs, we will skip counting it if it hasn't been used for a while
|
||||
int _hoursToSkipVMs = _hoursToSkipStoppedVMs;
|
||||
|
||||
if (vm.getState() == State.Destroyed)
|
||||
_hoursToSkipVMs = _hoursToSkipDestroyedVMs;
|
||||
|
||||
long millisecondsSinceLastUpdate = DateUtil.currentGMTTime().getTime() - vm.getUpdateTime().getTime();
|
||||
if(millisecondsSinceLastUpdate > _hoursToSkipStoppedVMs*3600000L) {
|
||||
if(millisecondsSinceLastUpdate > _hoursToSkipVMs*3600000L) {
|
||||
if(s_logger.isDebugEnabled())
|
||||
s_logger.debug("Skip counting vm " + vm.getInstanceName() + " in capacity allocation as it has been stopped for " + millisecondsSinceLastUpdate/60000 + " minutes");
|
||||
s_logger.debug("Skip counting " + vm.getState().toString() + " vm " + vm.getInstanceName() + " in capacity allocation as it has been " + vm.getState().toString().toLowerCase() + " for " + millisecondsSinceLastUpdate/60000 + " minutes");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -308,8 +314,10 @@ public class UserConcentratedAllocator implements PodAllocator {
|
||||
_name = name;
|
||||
|
||||
Map<String, String> configs = _configDao.getConfiguration("management-server", params);
|
||||
String value = configs.get("capacity.skipcounting.hours");
|
||||
_hoursToSkipStoppedVMs = NumbersUtil.parseInt(value, 24);
|
||||
String stoppedValue = configs.get("capacity.skipcounting.hours");
|
||||
String destroyedValue = configs.get("capacity.skipcounting.destroyed.hours");
|
||||
_hoursToSkipStoppedVMs = NumbersUtil.parseInt(stoppedValue, 24);
|
||||
_hoursToSkipDestroyedVMs = NumbersUtil.parseInt(destroyedValue, 0);
|
||||
|
||||
// TODO this is not good, there should be one place to get these values
|
||||
_secStorageVmRamSize = NumbersUtil.parseInt(configs.get("secstorage.vm.ram.size"), 256);
|
||||
|
||||
@ -61,7 +61,8 @@ public enum Config {
|
||||
// Usage
|
||||
|
||||
CapacityCheckPeriod("Usage", ManagementServer.class, Integer.class, "capacity.check.period", "300000", "The interval in milliseconds between capacity checks", null),
|
||||
CapacitySkipCountingHours("Usage", ManagementServer.class, Integer.class, "capacity.skipcounting.hours", "24", "The interval in hours since VM has stopped to skip counting its allocated CPU/Memory capacity", null),
|
||||
CapacitySkipCountingHours("Usage", ManagementServer.class, Integer.class, "capacity.skipcounting.hours", "24", "The interval in hours since VM has stopped to skip counting its allocated CPU/Memory capacity. Applies to vms in Stopped state", null),
|
||||
CapacitySkipCountingDestroyedHours("Usage", ManagementServer.class, Integer.class, "capacity.skipcounting.destroyed.hours", "0", "The interval in hours since VM has stopped to skip counting its allocated CPU/Memory capacity. Applies to vms in Destroyed state", null),
|
||||
StorageAllocatedCapacityThreshold("Usage", ManagementServer.class, Float.class, "storage.allocated.capacity.threshold", "0.85", "Percentage (as a value between 0 and 1) of allocated storage utilization above which alerts will be sent about low storage available.", null),
|
||||
StorageCapacityThreshold("Usage", ManagementServer.class, Float.class, "storage.capacity.threshold", "0.85", "Percentage (as a value between 0 and 1) of storage utilization above which alerts will be sent about low storage available.", null),
|
||||
CPUCapacityThreshold("Usage", ManagementServer.class, Float.class, "cpu.capacity.threshold", "0.85", "Percentage (as a value between 0 and 1) of cpu utilization above which alerts will be sent about low cpu available.", null),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user