You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit a30f9fa
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: engine/schema/src/com/cloud/capacity/dao/CapacityDaoImpl.java
+21-3Lines changed: 21 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -116,11 +116,27 @@ public class CapacityDaoImpl extends GenericDaoBase<CapacityVO, Long> implements
116
116
privatestaticfinalStringLIST_CAPACITY_GROUP_BY_CLUSTER_TYPE_PART2 = " GROUP BY cluster_id, capacity_type order by percent desc limit ";
117
117
privatestaticfinalStringUPDATE_CAPACITY_STATE = "UPDATE `cloud`.`op_host_capacity` SET capacity_state = ? WHERE ";
118
118
119
+
/* In the below query"LIST_CLUSTERS_CROSSING_THRESHOLD" the threshold value is getting from the cluster_details table if not present then it gets from the global configuration
120
+
*
121
+
* CASE statement works like
122
+
* if (cluster_details table has thershold value)
123
+
* then
124
+
* if (value from the cluster_details table is not null)
"CASE (SELECT count(*) FROM `cloud`.`cluster_details` details WHERE details.cluster_id = capacity.cluster_id AND details.name = ? ) " +
123
-
"WHEN 1 THEN ( SELECT details.value FROM `cloud`.`cluster_details` details WHERE details.cluster_id = capacity.cluster_id AND details.name = ? ) " +
137
+
"WHEN 1 THEN ( CASE WHEN (SELECT details.value FROM `cloud`.`cluster_details` details WHERE details.cluster_id = capacity.cluster_id AND details.name = ?) is NULL " +
138
+
"THEN (SELECT config.value FROM `cloud`.`configuration` config WHERE config.name = ?)" +
139
+
"ELSE (SELECT details.value FROM `cloud`.`cluster_details` details WHERE details.cluster_id = capacity.cluster_id AND details.name = ? ) END )" +
124
140
"ELSE ( SELECT config.value FROM `cloud`.`configuration` config WHERE config.name = ?) " +
125
141
"END configValue " +
126
142
"FROM `cloud`.`op_host_capacity` capacity " +
@@ -168,8 +184,10 @@ public List<Long> listClustersCrossingThreshold(short capacityType, Long zoneId
0 commit comments