You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ko...@apache.org on 2013/07/20 13:33:32 UTC
git commit: updated refs/heads/4.2 to f604e3d
Updated Branches:
refs/heads/4.2 17af34fd1 -> f604e3d9c
CLOUDSTACK-3365: cluster level parameters cluster.(cpu/memory).allocated.capacity.notificationthreshold is not considering overcommit value
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/f604e3d9
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/f604e3d9
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/f604e3d9
Branch: refs/heads/4.2
Commit: f604e3d9cc9073c8863bbd7dfc47fb6693a0b6f0
Parents: 17af34f
Author: Harikrishna Patnala <ha...@citrix.com>
Authored: Fri Jul 19 15:38:23 2013 +0530
Committer: Koushik Das <ko...@apache.org>
Committed: Sat Jul 20 17:03:05 2013 +0530
----------------------------------------------------------------------
.../src/com/cloud/alert/AlertManagerImpl.java | 29 ++++++++++++++------
1 file changed, 20 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f604e3d9/server/src/com/cloud/alert/AlertManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/alert/AlertManagerImpl.java b/server/src/com/cloud/alert/AlertManagerImpl.java
index 9b7cd27..bff36c7 100755
--- a/server/src/com/cloud/alert/AlertManagerImpl.java
+++ b/server/src/com/cloud/alert/AlertManagerImpl.java
@@ -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);
}