mirror of https://github.com/apache/cloudstack.git
CLOUDSTACK-3365: cluster level parameters cluster.(cpu/memory).allocated.capacity.notificationthreshold is not considering overcommit value
This commit is contained in:
parent
2000005f90
commit
78f1092df1
|
|
@ -502,6 +502,18 @@ public class AlertManagerImpl extends ManagerBase implements AlertManager {
|
|||
}
|
||||
}
|
||||
|
||||
private float getOverProvisioningFactor(long clusterId, short capacityType) {
|
||||
float overProvisioinigFactor = 1f;
|
||||
switch (capacityType) {
|
||||
case Capacity.CAPACITY_TYPE_CPU:
|
||||
overProvisioinigFactor = Float.parseFloat(_configServer.getConfigValue(Config.CPUOverprovisioningFactor.key(), Config.ConfigurationParameterScope.cluster.toString(), clusterId));
|
||||
break;
|
||||
case Capacity.CAPACITY_TYPE_MEMORY:
|
||||
overProvisioinigFactor = Float.parseFloat(_configServer.getConfigValue(Config.MemOverprovisioningFactor.key(), Config.ConfigurationParameterScope.cluster.toString(), clusterId));
|
||||
break;
|
||||
}
|
||||
return overProvisioinigFactor;
|
||||
}
|
||||
|
||||
public void checkForAlerts(){
|
||||
|
||||
|
|
@ -561,28 +573,27 @@ public class AlertManagerImpl extends ManagerBase implements AlertManager {
|
|||
for( ClusterVO cluster : clusterList){
|
||||
for (Short capacityType : clusterCapacityTypes){
|
||||
List<SummedCapacity> capacity = new ArrayList<SummedCapacity>();
|
||||
float overProvFactor = 1f;
|
||||
float overProvFactor = getOverProvisioningFactor(cluster.getId(), capacityType);
|
||||
capacity = _capacityDao.findCapacityBy(capacityType.intValue(), cluster.getDataCenterId(), null, cluster.getId());
|
||||
|
||||
// cpu and memory allocated capacity notification threshold can be defined at cluster level, so getting the value if they are defined at cluster level
|
||||
double capacityValue = 0;
|
||||
double threshold = 0;
|
||||
switch (capacityType) {
|
||||
case Capacity.CAPACITY_TYPE_STORAGE:
|
||||
capacity.add(getUsedStats(capacityType, cluster.getDataCenterId(), cluster.getPodId(), cluster.getId()));
|
||||
capacityValue = Double.parseDouble(_configServer.getConfigValue(Config.StorageCapacityThreshold.key(), Config.ConfigurationParameterScope.cluster.toString(), cluster.getId()));
|
||||
threshold = Double.parseDouble(_configServer.getConfigValue(Config.StorageCapacityThreshold.key(), Config.ConfigurationParameterScope.cluster.toString(), cluster.getId()));
|
||||
break;
|
||||
case Capacity.CAPACITY_TYPE_STORAGE_ALLOCATED:
|
||||
capacityValue = Double.parseDouble(_configServer.getConfigValue(Config.StorageAllocatedCapacityThreshold.key(), Config.ConfigurationParameterScope.cluster.toString(), cluster.getId()));
|
||||
threshold = Double.parseDouble(_configServer.getConfigValue(Config.StorageAllocatedCapacityThreshold.key(), Config.ConfigurationParameterScope.cluster.toString(), cluster.getId()));
|
||||
break;
|
||||
case Capacity.CAPACITY_TYPE_CPU:
|
||||
overProvFactor = ApiDBUtils.getCpuOverprovisioningFactor();
|
||||
capacityValue = Double.parseDouble(_configServer.getConfigValue(Config.CPUCapacityThreshold.key(), Config.ConfigurationParameterScope.cluster.toString(), cluster.getId()));
|
||||
threshold = Double.parseDouble(_configServer.getConfigValue(Config.CPUCapacityThreshold.key(), Config.ConfigurationParameterScope.cluster.toString(), cluster.getId()));
|
||||
break;
|
||||
case Capacity.CAPACITY_TYPE_MEMORY:
|
||||
capacityValue = Double.parseDouble(_configServer.getConfigValue(Config.MemoryCapacityThreshold.key(), Config.ConfigurationParameterScope.cluster.toString(), cluster.getId()));
|
||||
threshold = Double.parseDouble(_configServer.getConfigValue(Config.MemoryCapacityThreshold.key(), Config.ConfigurationParameterScope.cluster.toString(), cluster.getId()));
|
||||
break;
|
||||
default:
|
||||
capacityValue = _capacityTypeThresholdMap.get(capacityType);
|
||||
threshold = _capacityTypeThresholdMap.get(capacityType);
|
||||
}
|
||||
if (capacity == null || capacity.size() == 0){
|
||||
continue;
|
||||
|
|
@ -590,7 +601,7 @@ public class AlertManagerImpl extends ManagerBase implements AlertManager {
|
|||
|
||||
double totalCapacity = capacity.get(0).getTotalCapacity() * overProvFactor;
|
||||
double usedCapacity = capacity.get(0).getUsedCapacity() + capacity.get(0).getReservedCapacity();
|
||||
if (totalCapacity != 0 && usedCapacity/totalCapacity > capacityValue){
|
||||
if (totalCapacity != 0 && usedCapacity/totalCapacity > threshold){
|
||||
generateEmailAlert(ApiDBUtils.findZoneById(cluster.getDataCenterId()), ApiDBUtils.findPodById(cluster.getPodId()), cluster,
|
||||
totalCapacity, usedCapacity, capacityType);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue