You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by bf...@apache.org on 2013/11/21 23:10:32 UTC
[03/69] [abbrv] [partial] Reformatted all of the code.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d620df2b/engine/schema/src/com/cloud/capacity/dao/CapacityDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/capacity/dao/CapacityDaoImpl.java b/engine/schema/src/com/cloud/capacity/dao/CapacityDaoImpl.java
index a44b878..de5a370 100755
--- a/engine/schema/src/com/cloud/capacity/dao/CapacityDaoImpl.java
+++ b/engine/schema/src/com/cloud/capacity/dao/CapacityDaoImpl.java
@@ -27,18 +27,17 @@ import java.util.Map;
import javax.ejb.Local;
import javax.inject.Inject;
-import com.cloud.dc.ClusterDetailsDao;
-import com.cloud.dc.ClusterDetailsVO;
-import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
-import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Component;
+import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
+import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
+
import com.cloud.capacity.Capacity;
import com.cloud.capacity.CapacityVO;
+import com.cloud.dc.ClusterDetailsDao;
import com.cloud.storage.Storage;
import com.cloud.utils.Pair;
-import com.cloud.utils.db.Filter;
import com.cloud.utils.db.GenericDaoBase;
import com.cloud.utils.db.GenericSearchBuilder;
import com.cloud.utils.db.JoinBuilder.JoinType;
@@ -55,11 +54,15 @@ public class CapacityDaoImpl extends GenericDaoBase<CapacityVO, Long> implements
private static final Logger s_logger = Logger.getLogger(CapacityDaoImpl.class);
private static final String ADD_ALLOCATED_SQL = "UPDATE `cloud`.`op_host_capacity` SET used_capacity = used_capacity + ? WHERE host_id = ? AND capacity_type = ?";
- private static final String SUBTRACT_ALLOCATED_SQL = "UPDATE `cloud`.`op_host_capacity` SET used_capacity = used_capacity - ? WHERE host_id = ? AND capacity_type = ?";
+ private static final String SUBTRACT_ALLOCATED_SQL =
+ "UPDATE `cloud`.`op_host_capacity` SET used_capacity = used_capacity - ? WHERE host_id = ? AND capacity_type = ?";
- private static final String LIST_CLUSTERSINZONE_BY_HOST_CAPACITIES_PART1 = "SELECT DISTINCT capacity.cluster_id FROM `cloud`.`op_host_capacity` capacity INNER JOIN `cloud`.`cluster` cluster on (cluster.id = capacity.cluster_id AND cluster.removed is NULL) INNER JOIN `cloud`.`cluster_details` cluster_details ON (cluster.id = cluster_details.cluster_id ) WHERE ";
- private static final String LIST_CLUSTERSINZONE_BY_HOST_CAPACITIES_PART2 = " AND capacity_type = ? AND cluster_details.name= ? AND ((total_capacity * cluster_details.value ) - used_capacity + reserved_capacity) >= ? AND capacity.cluster_id IN (SELECT distinct capacity.cluster_id FROM `cloud`.`op_host_capacity` capacity INNER JOIN `cloud`.`cluster_details` cluster_details ON (capacity.cluster_id = cluster_details.cluster_id ) WHERE ";
- private static final String LIST_CLUSTERSINZONE_BY_HOST_CAPACITIES_PART3 = " AND capacity_type = ? AND cluster_details.name= ? AND ((total_capacity * cluster_details.value) - used_capacity + reserved_capacity) >= ?) ";
+ private static final String LIST_CLUSTERSINZONE_BY_HOST_CAPACITIES_PART1 =
+ "SELECT DISTINCT capacity.cluster_id FROM `cloud`.`op_host_capacity` capacity INNER JOIN `cloud`.`cluster` cluster on (cluster.id = capacity.cluster_id AND cluster.removed is NULL) INNER JOIN `cloud`.`cluster_details` cluster_details ON (cluster.id = cluster_details.cluster_id ) WHERE ";
+ private static final String LIST_CLUSTERSINZONE_BY_HOST_CAPACITIES_PART2 =
+ " AND capacity_type = ? AND cluster_details.name= ? AND ((total_capacity * cluster_details.value ) - used_capacity + reserved_capacity) >= ? AND capacity.cluster_id IN (SELECT distinct capacity.cluster_id FROM `cloud`.`op_host_capacity` capacity INNER JOIN `cloud`.`cluster_details` cluster_details ON (capacity.cluster_id = cluster_details.cluster_id ) WHERE ";
+ private static final String LIST_CLUSTERSINZONE_BY_HOST_CAPACITIES_PART3 =
+ " AND capacity_type = ? AND cluster_details.name= ? AND ((total_capacity * cluster_details.value) - used_capacity + reserved_capacity) >= ?) ";
private final SearchBuilder<CapacityVO> _hostIdTypeSearch;
private final SearchBuilder<CapacityVO> _hostOrPoolIdSearch;
@@ -69,65 +72,78 @@ public class CapacityDaoImpl extends GenericDaoBase<CapacityVO, Long> implements
@Inject
protected ClusterDetailsDao _clusterDetailsDao;
- private static final String LIST_HOSTS_IN_CLUSTER_WITH_ENOUGH_CAPACITY = " SELECT host_capacity.host_id FROM (`cloud`.`host` JOIN `cloud`.`op_host_capacity` host_capacity ON (host.id = host_capacity.host_id AND host.cluster_id = ?) JOIN `cloud`.`cluster_details` cluster_details ON (host_capacity.cluster_id = cluster_details.cluster_id) AND host.type = ? AND cluster_details.name='cpuOvercommitRatio' AND ((host_capacity.total_capacity *cluster_details.value ) - host_capacity.used_capacity) >= ? and host_capacity.capacity_type = '1' "
- + " AND host_capacity.host_id IN (SELECT capacity.host_id FROM `cloud`.`op_host_capacity` capacity JOIN `cloud`.`cluster_details` cluster_details ON (capacity.cluster_id= cluster_details.cluster_id) where capacity_type='0' AND cluster_details.name='memoryOvercommitRatio' AND ((total_capacity* cluster_details.value) - used_capacity ) >= ?)) ";
+ private static final String LIST_HOSTS_IN_CLUSTER_WITH_ENOUGH_CAPACITY =
+ " SELECT host_capacity.host_id FROM (`cloud`.`host` JOIN `cloud`.`op_host_capacity` host_capacity ON (host.id = host_capacity.host_id AND host.cluster_id = ?) JOIN `cloud`.`cluster_details` cluster_details ON (host_capacity.cluster_id = cluster_details.cluster_id) AND host.type = ? AND cluster_details.name='cpuOvercommitRatio' AND ((host_capacity.total_capacity *cluster_details.value ) - host_capacity.used_capacity) >= ? and host_capacity.capacity_type = '1' "
+ + " AND host_capacity.host_id IN (SELECT capacity.host_id FROM `cloud`.`op_host_capacity` capacity JOIN `cloud`.`cluster_details` cluster_details ON (capacity.cluster_id= cluster_details.cluster_id) where capacity_type='0' AND cluster_details.name='memoryOvercommitRatio' AND ((total_capacity* cluster_details.value) - used_capacity ) >= ?)) ";
- private static final String ORDER_CLUSTERS_BY_AGGREGATE_CAPACITY_PART1 = "SELECT capacity.cluster_id, SUM(used_capacity+reserved_capacity)/SUM(total_capacity ) FROM `cloud`.`op_host_capacity` capacity WHERE ";
+ private static final String ORDER_CLUSTERS_BY_AGGREGATE_CAPACITY_PART1 =
+ "SELECT capacity.cluster_id, SUM(used_capacity+reserved_capacity)/SUM(total_capacity ) FROM `cloud`.`op_host_capacity` capacity WHERE ";
- private static final String ORDER_CLUSTERS_BY_AGGREGATE_CAPACITY_PART2 = " AND capacity_type = ? AND cluster_details.name =? GROUP BY capacity.cluster_id ORDER BY SUM(used_capacity+reserved_capacity)/SUM(total_capacity * cluster_details.value) ASC";
+ private static final String ORDER_CLUSTERS_BY_AGGREGATE_CAPACITY_PART2 =
+ " AND capacity_type = ? AND cluster_details.name =? GROUP BY capacity.cluster_id ORDER BY SUM(used_capacity+reserved_capacity)/SUM(total_capacity * cluster_details.value) ASC";
- private static final String ORDER_CLUSTERS_BY_AGGREGATE_OVERCOMMIT_CAPACITY_PART1 = "SELECT capacity.cluster_id, SUM(used_capacity+reserved_capacity)/SUM(total_capacity * cluster_details.value) FROM `cloud`.`op_host_capacity` capacity INNER JOIN `cloud`.`cluster_details` cluster_details ON (capacity.cluster_id = cluster_details.cluster_id) WHERE ";
+ private static final String ORDER_CLUSTERS_BY_AGGREGATE_OVERCOMMIT_CAPACITY_PART1 =
+ "SELECT capacity.cluster_id, SUM(used_capacity+reserved_capacity)/SUM(total_capacity * cluster_details.value) FROM `cloud`.`op_host_capacity` capacity INNER JOIN `cloud`.`cluster_details` cluster_details ON (capacity.cluster_id = cluster_details.cluster_id) WHERE ";
- private static final String ORDER_CLUSTERS_BY_AGGREGATE_OVERCOMMIT_CAPACITY_PART2 = " AND capacity_type = ? AND cluster_details.name =? GROUP BY capacity.cluster_id ORDER BY SUM(used_capacity+reserved_capacity)/SUM(total_capacity * cluster_details.value) ASC";
+ private static final String ORDER_CLUSTERS_BY_AGGREGATE_OVERCOMMIT_CAPACITY_PART2 =
+ " AND capacity_type = ? AND cluster_details.name =? GROUP BY capacity.cluster_id ORDER BY SUM(used_capacity+reserved_capacity)/SUM(total_capacity * cluster_details.value) ASC";
- private static final String LIST_PODSINZONE_BY_HOST_CAPACITY_TYPE = "SELECT DISTINCT capacity.pod_id FROM `cloud`.`op_host_capacity` capacity INNER JOIN `cloud`.`host_pod_ref` pod "
- + " ON (pod.id = capacity.pod_id AND pod.removed is NULL) INNER JOIN `cloud`.`cluster_details` cluster_details ON (capacity.cluster_id = cluster_details.cluster_id ) WHERE capacity.data_center_id = ? AND capacity_type = ? AND cluster_details.name= ? AND ((total_capacity * cluster_details.value ) - used_capacity + reserved_capacity) >= ? ";
+ private static final String LIST_PODSINZONE_BY_HOST_CAPACITY_TYPE =
+ "SELECT DISTINCT capacity.pod_id FROM `cloud`.`op_host_capacity` capacity INNER JOIN `cloud`.`host_pod_ref` pod "
+ + " ON (pod.id = capacity.pod_id AND pod.removed is NULL) INNER JOIN `cloud`.`cluster_details` cluster_details ON (capacity.cluster_id = cluster_details.cluster_id ) WHERE capacity.data_center_id = ? AND capacity_type = ? AND cluster_details.name= ? AND ((total_capacity * cluster_details.value ) - used_capacity + reserved_capacity) >= ? ";
- private static final String ORDER_PODS_BY_AGGREGATE_CAPACITY = " SELECT capacity.pod_id, SUM(used_capacity+reserved_capacity)/SUM(total_capacity) FROM `cloud`.`op_host_capacity` capacity WHERE data_center_id= ? AND capacity_type = ? GROUP BY capacity.pod_id ORDER BY SUM(used_capacity+reserved_capacity)/SUM(total_capacity) ASC ";
+ private static final String ORDER_PODS_BY_AGGREGATE_CAPACITY =
+ " SELECT capacity.pod_id, SUM(used_capacity+reserved_capacity)/SUM(total_capacity) FROM `cloud`.`op_host_capacity` capacity WHERE data_center_id= ? AND capacity_type = ? GROUP BY capacity.pod_id ORDER BY SUM(used_capacity+reserved_capacity)/SUM(total_capacity) ASC ";
- private static final String ORDER_PODS_BY_AGGREGATE_OVERCOMMIT_CAPACITY = "SELECT capacity.pod_id, SUM(used_capacity+reserved_capacity)/SUM(total_capacity * cluster_details.value) FROM `cloud`.`op_host_capacity` capacity INNER JOIN `cloud`.`cluster_details` cluster_details ON (capacity.cluster_id = cluster_details.cluster_id) WHERE data_center_id=? AND capacity_type = ? AND cluster_details.name = ? GROUP BY capacity.pod_id ORDER BY SUM(used_capacity+reserved_capacity)/SUM(total_capacity * cluster_details.value) ASC";
+ private static final String ORDER_PODS_BY_AGGREGATE_OVERCOMMIT_CAPACITY =
+ "SELECT capacity.pod_id, SUM(used_capacity+reserved_capacity)/SUM(total_capacity * cluster_details.value) FROM `cloud`.`op_host_capacity` capacity INNER JOIN `cloud`.`cluster_details` cluster_details ON (capacity.cluster_id = cluster_details.cluster_id) WHERE data_center_id=? AND capacity_type = ? AND cluster_details.name = ? GROUP BY capacity.pod_id ORDER BY SUM(used_capacity+reserved_capacity)/SUM(total_capacity * cluster_details.value) ASC";
- private static final String LIST_CAPACITY_BY_RESOURCE_STATE = "SELECT capacity.data_center_id, sum(capacity.used_capacity), sum(capacity.reserved_quantity), sum(capacity.total_capacity), capacity_capacity_type "
- + "FROM `cloud`.`op_host_capacity` capacity INNER JOIN `cloud`.`data_center` dc ON (dc.id = capacity.data_center_id AND dc.removed is NULL)"
- + "FROM `cloud`.`op_host_capacity` capacity INNER JOIN `cloud`.`host_pod_ref` pod ON (pod.id = capacity.pod_id AND pod.removed is NULL)"
- + "FROM `cloud`.`op_host_capacity` capacity INNER JOIN `cloud`.`cluster` cluster ON (cluster.id = capacity.cluster_id AND cluster.removed is NULL)"
- + "FROM `cloud`.`op_host_capacity` capacity INNER JOIN `cloud`.`host` host ON (host.id = capacity.host_id AND host.removed is NULL)"
- + "WHERE dc.allocation_state = ? AND pod.allocation_state = ? AND cluster.allocation_state = ? AND host.resource_state = ? AND capacity_type not in (3,4) ";
+ private static final String LIST_CAPACITY_BY_RESOURCE_STATE =
+ "SELECT capacity.data_center_id, sum(capacity.used_capacity), sum(capacity.reserved_quantity), sum(capacity.total_capacity), capacity_capacity_type "
+ + "FROM `cloud`.`op_host_capacity` capacity INNER JOIN `cloud`.`data_center` dc ON (dc.id = capacity.data_center_id AND dc.removed is NULL)"
+ + "FROM `cloud`.`op_host_capacity` capacity INNER JOIN `cloud`.`host_pod_ref` pod ON (pod.id = capacity.pod_id AND pod.removed is NULL)"
+ + "FROM `cloud`.`op_host_capacity` capacity INNER JOIN `cloud`.`cluster` cluster ON (cluster.id = capacity.cluster_id AND cluster.removed is NULL)"
+ + "FROM `cloud`.`op_host_capacity` capacity INNER JOIN `cloud`.`host` host ON (host.id = capacity.host_id AND host.removed is NULL)"
+ + "WHERE dc.allocation_state = ? AND pod.allocation_state = ? AND cluster.allocation_state = ? AND host.resource_state = ? AND capacity_type not in (3,4) ";
- private static final String LIST_CAPACITY_GROUP_BY_ZONE_TYPE_PART1 = "SELECT sum(capacity.used_capacity), sum(capacity.reserved_capacity),"
- + " (case capacity_type when 1 then (sum(total_capacity) * (select value from `cloud`.`cluster_details` where cluster_details.name= 'cpuOvercommitRatio' AND cluster_details.cluster_id=capacity.cluster_id))"
- + "when '0' then (sum(total_capacity) * (select value from `cloud`.`cluster_details` where cluster_details.name= 'memoryOvercommitRatio' AND cluster_details.cluster_id=capacity.cluster_id))"
- + "else sum(total_capacity) end),"
- + "((sum(capacity.used_capacity) + sum(capacity.reserved_capacity)) / ( case capacity_type when 1 then (sum(total_capacity) * (select value from `cloud`.`cluster_details` where cluster_details.name= 'cpuOvercommitRatio' AND cluster_details.cluster_id=capacity.cluster_id))"
- + "when '0' then (sum(total_capacity) * (select value from `cloud`.`cluster_details` where cluster_details.name='memoryOvercommitRatio' AND cluster_details.cluster_id=capacity.cluster_id))else sum(total_capacity) end)) percent,"
- + "capacity.capacity_type, capacity.data_center_id FROM `cloud`.`op_host_capacity` capacity WHERE total_capacity > 0 AND data_center_id is not null AND capacity_state='Enabled'";
+ private static final String LIST_CAPACITY_GROUP_BY_ZONE_TYPE_PART1 =
+ "SELECT sum(capacity.used_capacity), sum(capacity.reserved_capacity),"
+ + " (case capacity_type when 1 then (sum(total_capacity) * (select value from `cloud`.`cluster_details` where cluster_details.name= 'cpuOvercommitRatio' AND cluster_details.cluster_id=capacity.cluster_id))"
+ + "when '0' then (sum(total_capacity) * (select value from `cloud`.`cluster_details` where cluster_details.name= 'memoryOvercommitRatio' AND cluster_details.cluster_id=capacity.cluster_id))"
+ + "else sum(total_capacity) end),"
+ + "((sum(capacity.used_capacity) + sum(capacity.reserved_capacity)) / ( case capacity_type when 1 then (sum(total_capacity) * (select value from `cloud`.`cluster_details` where cluster_details.name= 'cpuOvercommitRatio' AND cluster_details.cluster_id=capacity.cluster_id))"
+ + "when '0' then (sum(total_capacity) * (select value from `cloud`.`cluster_details` where cluster_details.name='memoryOvercommitRatio' AND cluster_details.cluster_id=capacity.cluster_id))else sum(total_capacity) end)) percent,"
+ + "capacity.capacity_type, capacity.data_center_id FROM `cloud`.`op_host_capacity` capacity WHERE total_capacity > 0 AND data_center_id is not null AND capacity_state='Enabled'";
private static final String LIST_CAPACITY_GROUP_BY_ZONE_TYPE_PART2 = " GROUP BY data_center_id, capacity_type order by percent desc limit ";
- private static final String LIST_CAPACITY_GROUP_BY_POD_TYPE_PART1 = "SELECT sum(capacity.used_capacity), sum(capacity.reserved_capacity),"
- + " (case capacity_type when 1 then (sum(total_capacity) * (select value from `cloud`.`cluster_details` where cluster_details.name= 'cpuOvercommitRatio' AND cluster_details.cluster_id=capacity.cluster_id)) "
- + "when '0' then (sum(total_capacity) * (select value from `cloud`.`cluster_details` where cluster_details.name= 'memoryOvercommitRatio' AND cluster_details.cluster_id=capacity.cluster_id))else sum(total_capacity) end),"
- + "((sum(capacity.used_capacity) + sum(capacity.reserved_capacity)) / ( case capacity_type when 1 then (sum(total_capacity) * (select value from `cloud`.`cluster_details` where cluster_details.name= 'cpuOvercommitRatio' AND cluster_details.cluster_id=capacity.cluster_id)) "
- + "when '0' then (sum(total_capacity) * (select value from `cloud`.`cluster_details` where cluster_details.name= 'memoryOvercommitRatio' AND cluster_details.cluster_id=capacity.cluster_id))else sum(total_capacity) end)) percent,"
- + "capacity.capacity_type, capacity.data_center_id, pod_id FROM `cloud`.`op_host_capacity` capacity WHERE total_capacity > 0 AND data_center_id is not null AND capacity_state='Enabled' ";
+ private static final String LIST_CAPACITY_GROUP_BY_POD_TYPE_PART1 =
+ "SELECT sum(capacity.used_capacity), sum(capacity.reserved_capacity),"
+ + " (case capacity_type when 1 then (sum(total_capacity) * (select value from `cloud`.`cluster_details` where cluster_details.name= 'cpuOvercommitRatio' AND cluster_details.cluster_id=capacity.cluster_id)) "
+ + "when '0' then (sum(total_capacity) * (select value from `cloud`.`cluster_details` where cluster_details.name= 'memoryOvercommitRatio' AND cluster_details.cluster_id=capacity.cluster_id))else sum(total_capacity) end),"
+ + "((sum(capacity.used_capacity) + sum(capacity.reserved_capacity)) / ( case capacity_type when 1 then (sum(total_capacity) * (select value from `cloud`.`cluster_details` where cluster_details.name= 'cpuOvercommitRatio' AND cluster_details.cluster_id=capacity.cluster_id)) "
+ + "when '0' then (sum(total_capacity) * (select value from `cloud`.`cluster_details` where cluster_details.name= 'memoryOvercommitRatio' AND cluster_details.cluster_id=capacity.cluster_id))else sum(total_capacity) end)) percent,"
+ + "capacity.capacity_type, capacity.data_center_id, pod_id FROM `cloud`.`op_host_capacity` capacity WHERE total_capacity > 0 AND data_center_id is not null AND capacity_state='Enabled' ";
private static final String LIST_CAPACITY_GROUP_BY_POD_TYPE_PART2 = " GROUP BY pod_id, capacity_type order by percent desc limit ";
- private static final String LIST_CAPACITY_GROUP_BY_CLUSTER_TYPE_PART1 = "SELECT sum(capacity.used_capacity), sum(capacity.reserved_capacity),"
- + " (case capacity_type when 1 then (sum(total_capacity) * (select value from `cloud`.`cluster_details` where cluster_details.name= 'cpuOvercommitRatio' AND cluster_details.cluster_id=capacity.cluster_id)) "
- + "when '0' then (sum(total_capacity) * (select value from `cloud`.`cluster_details` where cluster_details.name= 'memoryOvercommitRatio' AND cluster_details.cluster_id=capacity.cluster_id))else sum(total_capacity) end),"
- + "((sum(capacity.used_capacity) + sum(capacity.reserved_capacity)) / ( case capacity_type when 1 then (sum(total_capacity) * (select value from `cloud`.`cluster_details` where cluster_details.name= 'cpuOvercommitRatio' AND cluster_details.cluster_id=capacity.cluster_id)) "
- + "when '0' then (sum(total_capacity) * (select value from `cloud`.`cluster_details` where cluster_details.name= 'memoryOvercommitRatio' AND cluster_details.cluster_id=capacity.cluster_id))else sum(total_capacity) end)) percent,"
- + "capacity.capacity_type, capacity.data_center_id, pod_id, cluster_id FROM `cloud`.`op_host_capacity` capacity WHERE total_capacity > 0 AND data_center_id is not null AND capacity_state='Enabled' ";
+ private static final String LIST_CAPACITY_GROUP_BY_CLUSTER_TYPE_PART1 =
+ "SELECT sum(capacity.used_capacity), sum(capacity.reserved_capacity),"
+ + " (case capacity_type when 1 then (sum(total_capacity) * (select value from `cloud`.`cluster_details` where cluster_details.name= 'cpuOvercommitRatio' AND cluster_details.cluster_id=capacity.cluster_id)) "
+ + "when '0' then (sum(total_capacity) * (select value from `cloud`.`cluster_details` where cluster_details.name= 'memoryOvercommitRatio' AND cluster_details.cluster_id=capacity.cluster_id))else sum(total_capacity) end),"
+ + "((sum(capacity.used_capacity) + sum(capacity.reserved_capacity)) / ( case capacity_type when 1 then (sum(total_capacity) * (select value from `cloud`.`cluster_details` where cluster_details.name= 'cpuOvercommitRatio' AND cluster_details.cluster_id=capacity.cluster_id)) "
+ + "when '0' then (sum(total_capacity) * (select value from `cloud`.`cluster_details` where cluster_details.name= 'memoryOvercommitRatio' AND cluster_details.cluster_id=capacity.cluster_id))else sum(total_capacity) end)) percent,"
+ + "capacity.capacity_type, capacity.data_center_id, pod_id, cluster_id FROM `cloud`.`op_host_capacity` capacity WHERE total_capacity > 0 AND data_center_id is not null AND capacity_state='Enabled' ";
private static final String LIST_CAPACITY_GROUP_BY_CLUSTER_TYPE_PART2 = " GROUP BY cluster_id, capacity_type order by percent desc limit ";
private static final String UPDATE_CAPACITY_STATE = "UPDATE `cloud`.`op_host_capacity` SET capacity_state = ? WHERE ";
- private static final String LIST_CAPACITY_GROUP_BY_CAPACITY_PART1 = "SELECT sum(capacity.used_capacity), sum(capacity.reserved_capacity),"
- + " (case capacity_type when 1 then (sum(total_capacity) * (select value from `cloud`.`cluster_details` where cluster_details.name= 'cpuOvercommitRatio' AND cluster_details.cluster_id=capacity.cluster_id)) "
- + "when '0' then (sum(total_capacity) * (select value from `cloud`.`cluster_details` where cluster_details.name= 'memoryOvercommitRatio' AND cluster_details.cluster_id=capacity.cluster_id))else sum(total_capacity) end),"
- + "((sum(capacity.used_capacity) + sum(capacity.reserved_capacity)) / ( case capacity_type when 1 then (sum(total_capacity) * (select value from `cloud`.`cluster_details` where cluster_details.name= 'cpuOvercommitRatio' AND cluster_details.cluster_id=capacity.cluster_id)) "
- + "when '0' then (sum(total_capacity) * (select value from `cloud`.`cluster_details` where cluster_details.name= 'memoryOvercommitRatio' AND cluster_details.cluster_id=capacity.cluster_id)) else sum(total_capacity) end)) percent,"
- + "capacity.capacity_type, capacity.data_center_id, pod_id FROM `cloud`.`op_host_capacity` capacity WHERE total_capacity > 0 AND data_center_id is not null AND capacity_state='Enabled' ";
+ private static final String LIST_CAPACITY_GROUP_BY_CAPACITY_PART1 =
+ "SELECT sum(capacity.used_capacity), sum(capacity.reserved_capacity),"
+ + " (case capacity_type when 1 then (sum(total_capacity) * (select value from `cloud`.`cluster_details` where cluster_details.name= 'cpuOvercommitRatio' AND cluster_details.cluster_id=capacity.cluster_id)) "
+ + "when '0' then (sum(total_capacity) * (select value from `cloud`.`cluster_details` where cluster_details.name= 'memoryOvercommitRatio' AND cluster_details.cluster_id=capacity.cluster_id))else sum(total_capacity) end),"
+ + "((sum(capacity.used_capacity) + sum(capacity.reserved_capacity)) / ( case capacity_type when 1 then (sum(total_capacity) * (select value from `cloud`.`cluster_details` where cluster_details.name= 'cpuOvercommitRatio' AND cluster_details.cluster_id=capacity.cluster_id)) "
+ + "when '0' then (sum(total_capacity) * (select value from `cloud`.`cluster_details` where cluster_details.name= 'memoryOvercommitRatio' AND cluster_details.cluster_id=capacity.cluster_id)) else sum(total_capacity) end)) percent,"
+ + "capacity.capacity_type, capacity.data_center_id, pod_id FROM `cloud`.`op_host_capacity` capacity WHERE total_capacity > 0 AND data_center_id is not null AND capacity_state='Enabled' ";
private static final String LIST_CAPACITY_GROUP_BY_CAPACITY_PART2 = " GROUP BY capacity_type";
@@ -145,20 +161,19 @@ public class CapacityDaoImpl extends GenericDaoBase<CapacityVO, Long> implements
* query from the configuration table
*
* */
- private static final String LIST_CLUSTERS_CROSSING_THRESHOLD = "SELECT clusterList.cluster_id "
- + "FROM ( SELECT cluster.cluster_id cluster_id, ( (sum(cluster.used) + sum(cluster.reserved) + ?)/sum(cluster.total) ) ratio, cluster.configValue value "
- + "FROM ( SELECT capacity.cluster_id cluster_id, capacity.used_capacity used, capacity.reserved_capacity reserved, capacity.total_capacity * overcommit.value total, "
- + "CASE (SELECT count(*) FROM `cloud`.`cluster_details` details WHERE details.cluster_id = capacity.cluster_id AND details.name = ? ) "
- + "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 "
- + "THEN (SELECT config.value FROM `cloud`.`configuration` config WHERE config.name = ?)"
- + "ELSE (SELECT details.value FROM `cloud`.`cluster_details` details WHERE details.cluster_id = capacity.cluster_id AND details.name = ? ) END )"
- + "ELSE ( SELECT config.value FROM `cloud`.`configuration` config WHERE config.name = ?) "
- + "END configValue "
- + "FROM `cloud`.`op_host_capacity` capacity INNER JOIN `cloud`.`cluster_details` overcommit ON overcommit.cluster_id = capacity.cluster_id "
- + "WHERE capacity.data_center_id = ? AND capacity.capacity_type = ? AND capacity.total_capacity > 0 AND overcommit.name = ?) cluster "
- +
-
- "GROUP BY cluster.cluster_id) clusterList " + "WHERE clusterList.ratio > clusterList.value; ";
+ private static final String LIST_CLUSTERS_CROSSING_THRESHOLD =
+ "SELECT clusterList.cluster_id "
+ + "FROM ( SELECT cluster.cluster_id cluster_id, ( (sum(cluster.used) + sum(cluster.reserved) + ?)/sum(cluster.total) ) ratio, cluster.configValue value "
+ + "FROM ( SELECT capacity.cluster_id cluster_id, capacity.used_capacity used, capacity.reserved_capacity reserved, capacity.total_capacity * overcommit.value total, "
+ + "CASE (SELECT count(*) FROM `cloud`.`cluster_details` details WHERE details.cluster_id = capacity.cluster_id AND details.name = ? ) "
+ + "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 "
+ + "THEN (SELECT config.value FROM `cloud`.`configuration` config WHERE config.name = ?)"
+ + "ELSE (SELECT details.value FROM `cloud`.`cluster_details` details WHERE details.cluster_id = capacity.cluster_id AND details.name = ? ) END )"
+ + "ELSE ( SELECT config.value FROM `cloud`.`configuration` config WHERE config.name = ?) " + "END configValue "
+ + "FROM `cloud`.`op_host_capacity` capacity INNER JOIN `cloud`.`cluster_details` overcommit ON overcommit.cluster_id = capacity.cluster_id "
+ + "WHERE capacity.data_center_id = ? AND capacity.capacity_type = ? AND capacity.total_capacity > 0 AND overcommit.name = ?) cluster " +
+
+ "GROUP BY cluster.cluster_id) clusterList " + "WHERE clusterList.ratio > clusterList.value; ";
public CapacityDaoImpl() {
_hostIdTypeSearch = createSearchBuilder();
@@ -358,8 +373,8 @@ public class CapacityDaoImpl extends GenericDaoBase<CapacityVO, Long> implements
if (level == 3 && rs.getLong(7) != 0)
capacityClusterId = rs.getLong(7);
- SummedCapacity summedCapacity = new SummedCapacity(rs.getLong(1), rs.getLong(2), rs.getLong(3), rs.getFloat(4), (short)rs.getLong(5), rs.getLong(6), capacityPodId,
- capacityClusterId);
+ SummedCapacity summedCapacity =
+ new SummedCapacity(rs.getLong(1), rs.getLong(2), rs.getLong(3), rs.getFloat(4), (short)rs.getLong(5), rs.getLong(6), capacityPodId, capacityClusterId);
result.add(summedCapacity);
}
@@ -475,11 +490,11 @@ public class CapacityDaoImpl extends GenericDaoBase<CapacityVO, Long> implements
try {
pstmt = txn.prepareAutoCloseStatement(sql.toString());
pstmt.setLong(1, id);
- pstmt.setShort(2, CapacityVO.CAPACITY_TYPE_CPU);
+ pstmt.setShort(2, Capacity.CAPACITY_TYPE_CPU);
pstmt.setString(3, "cpuOvercommitRatio");
pstmt.setLong(4, requiredCpu);
pstmt.setLong(5, id);
- pstmt.setShort(6, CapacityVO.CAPACITY_TYPE_MEMORY);
+ pstmt.setShort(6, Capacity.CAPACITY_TYPE_MEMORY);
pstmt.setString(7, "memoryOvercommitRatio");
pstmt.setLong(8, requiredRam);
@@ -652,7 +667,8 @@ public class CapacityDaoImpl extends GenericDaoBase<CapacityVO, Long> implements
SearchBuilder<StoragePoolVO> nonSharedStorage = _storagePoolDao.createSearchBuilder();
nonSharedStorage.and("poolTypes", nonSharedStorage.entity().getPoolType(), SearchCriteria.Op.IN);
- SummedCapacitySearch.join("nonSharedStorage", nonSharedStorage, nonSharedStorage.entity().getId(), SummedCapacitySearch.entity().getHostOrPoolId(), JoinType.INNER);
+ SummedCapacitySearch.join("nonSharedStorage", nonSharedStorage, nonSharedStorage.entity().getId(), SummedCapacitySearch.entity().getHostOrPoolId(),
+ JoinType.INNER);
nonSharedStorage.done();
if (zoneId != null) {
@@ -772,11 +788,11 @@ public class CapacityDaoImpl extends GenericDaoBase<CapacityVO, Long> implements
try {
pstmt = txn.prepareAutoCloseStatement(sql.toString());
pstmt.setLong(1, zoneId);
- pstmt.setShort(2, CapacityVO.CAPACITY_TYPE_CPU);
+ pstmt.setShort(2, Capacity.CAPACITY_TYPE_CPU);
pstmt.setString(3, "cpuOvercommitRatio");
pstmt.setLong(4, requiredCpu);
pstmt.setLong(5, zoneId);
- pstmt.setShort(6, CapacityVO.CAPACITY_TYPE_MEMORY);
+ pstmt.setShort(6, Capacity.CAPACITY_TYPE_MEMORY);
pstmt.setString(7, "memoryOvercommitRatio");
pstmt.setLong(8, requiredRam);
@@ -800,15 +816,15 @@ public class CapacityDaoImpl extends GenericDaoBase<CapacityVO, Long> implements
Map<Long, Double> podCapacityMap = new HashMap<Long, Double>();
StringBuilder sql = null;
try {
- if (capacityTypeForOrdering == CapacityVO.CAPACITY_TYPE_CPU | capacityTypeForOrdering == CapacityVO.CAPACITY_TYPE_MEMORY) {
+ if (capacityTypeForOrdering == Capacity.CAPACITY_TYPE_CPU | capacityTypeForOrdering == Capacity.CAPACITY_TYPE_MEMORY) {
sql = new StringBuilder(ORDER_PODS_BY_AGGREGATE_OVERCOMMIT_CAPACITY);
pstmt = txn.prepareAutoCloseStatement(sql.toString());
pstmt.setLong(1, zoneId);
pstmt.setShort(2, capacityTypeForOrdering);
- if (capacityTypeForOrdering == CapacityVO.CAPACITY_TYPE_CPU) {
+ if (capacityTypeForOrdering == Capacity.CAPACITY_TYPE_CPU) {
pstmt.setString(3, "cpuOvercommitRatio");
- } else if (capacityTypeForOrdering == CapacityVO.CAPACITY_TYPE_MEMORY) {
+ } else if (capacityTypeForOrdering == Capacity.CAPACITY_TYPE_MEMORY) {
pstmt.setString(3, "memoryOvercommitRatio");
}
} else {
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d620df2b/engine/schema/src/com/cloud/certificate/CertificateVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/certificate/CertificateVO.java b/engine/schema/src/com/cloud/certificate/CertificateVO.java
index 1b42ffd..11bf8e8 100644
--- a/engine/schema/src/com/cloud/certificate/CertificateVO.java
+++ b/engine/schema/src/com/cloud/certificate/CertificateVO.java
@@ -16,8 +16,6 @@
// under the License.
package com.cloud.certificate;
-import org.apache.cloudstack.api.InternalIdentity;
-
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
@@ -25,6 +23,8 @@ import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
+import org.apache.cloudstack.api.InternalIdentity;
+
@Entity
@Table(name = "certificate")
public class CertificateVO implements InternalIdentity {
@@ -43,6 +43,7 @@ public class CertificateVO implements InternalIdentity {
public CertificateVO() {
}
+ @Override
public long getId() {
return id;
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d620df2b/engine/schema/src/com/cloud/cluster/agentlb/HostTransferMapVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/cluster/agentlb/HostTransferMapVO.java b/engine/schema/src/com/cloud/cluster/agentlb/HostTransferMapVO.java
index b307589..8d28b8e 100644
--- a/engine/schema/src/com/cloud/cluster/agentlb/HostTransferMapVO.java
+++ b/engine/schema/src/com/cloud/cluster/agentlb/HostTransferMapVO.java
@@ -25,9 +25,10 @@ import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.Table;
-import com.cloud.utils.db.GenericDao;
import org.apache.cloudstack.api.InternalIdentity;
+import com.cloud.utils.db.GenericDao;
+
@Entity
@Table(name = "op_host_transfer")
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
@@ -87,6 +88,7 @@ public class HostTransferMapVO implements InternalIdentity {
this.state = state;
}
+ @Override
public long getId() {
return id;
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d620df2b/engine/schema/src/com/cloud/configuration/ResourceCountVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/configuration/ResourceCountVO.java b/engine/schema/src/com/cloud/configuration/ResourceCountVO.java
index 0f959df..ae8f382 100644
--- a/engine/schema/src/com/cloud/configuration/ResourceCountVO.java
+++ b/engine/schema/src/com/cloud/configuration/ResourceCountVO.java
@@ -16,8 +16,6 @@
// under the License.
package com.cloud.configuration;
-import org.apache.cloudstack.api.InternalIdentity;
-
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d620df2b/engine/schema/src/com/cloud/configuration/ResourceLimitVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/configuration/ResourceLimitVO.java b/engine/schema/src/com/cloud/configuration/ResourceLimitVO.java
index c131495..3921709 100644
--- a/engine/schema/src/com/cloud/configuration/ResourceLimitVO.java
+++ b/engine/schema/src/com/cloud/configuration/ResourceLimitVO.java
@@ -16,8 +16,6 @@
// under the License.
package com.cloud.configuration;
-import org.apache.cloudstack.api.InternalIdentity;
-
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d620df2b/engine/schema/src/com/cloud/configuration/dao/ResourceCountDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/configuration/dao/ResourceCountDaoImpl.java b/engine/schema/src/com/cloud/configuration/dao/ResourceCountDaoImpl.java
index 4740fea..be429b5 100644
--- a/engine/schema/src/com/cloud/configuration/dao/ResourceCountDaoImpl.java
+++ b/engine/schema/src/com/cloud/configuration/dao/ResourceCountDaoImpl.java
@@ -32,10 +32,8 @@ import com.cloud.configuration.Resource.ResourceType;
import com.cloud.configuration.ResourceCountVO;
import com.cloud.configuration.ResourceLimit;
import com.cloud.domain.dao.DomainDao;
-import com.cloud.domain.dao.DomainDaoImpl;
import com.cloud.exception.UnsupportedServiceException;
import com.cloud.user.dao.AccountDao;
-import com.cloud.user.dao.AccountDaoImpl;
import com.cloud.utils.db.DB;
import com.cloud.utils.db.GenericDaoBase;
import com.cloud.utils.db.SearchBuilder;
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d620df2b/engine/schema/src/com/cloud/dc/AccountVlanMapVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/dc/AccountVlanMapVO.java b/engine/schema/src/com/cloud/dc/AccountVlanMapVO.java
index f01d362..6461a96 100644
--- a/engine/schema/src/com/cloud/dc/AccountVlanMapVO.java
+++ b/engine/schema/src/com/cloud/dc/AccountVlanMapVO.java
@@ -23,9 +23,10 @@ import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
-import com.cloud.user.OwnedBy;
import org.apache.cloudstack.api.InternalIdentity;
+import com.cloud.user.OwnedBy;
+
@Entity
@Table(name = "account_vlan_map")
public class AccountVlanMapVO implements OwnedBy, InternalIdentity {
@@ -50,6 +51,7 @@ public class AccountVlanMapVO implements OwnedBy, InternalIdentity {
}
+ @Override
public long getId() {
return id;
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d620df2b/engine/schema/src/com/cloud/dc/ClusterDetailsVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/dc/ClusterDetailsVO.java b/engine/schema/src/com/cloud/dc/ClusterDetailsVO.java
index 9de85b5..6eb9e74 100644
--- a/engine/schema/src/com/cloud/dc/ClusterDetailsVO.java
+++ b/engine/schema/src/com/cloud/dc/ClusterDetailsVO.java
@@ -16,8 +16,6 @@
// under the License.
package com.cloud.dc;
-import org.apache.cloudstack.api.InternalIdentity;
-
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
@@ -25,6 +23,8 @@ import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
+import org.apache.cloudstack.api.InternalIdentity;
+
@Entity
@Table(name = "cluster_details")
public class ClusterDetailsVO implements InternalIdentity {
@@ -68,6 +68,7 @@ public class ClusterDetailsVO implements InternalIdentity {
this.value = value;
}
+ @Override
public long getId() {
return id;
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d620df2b/engine/schema/src/com/cloud/dc/ClusterVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/dc/ClusterVO.java b/engine/schema/src/com/cloud/dc/ClusterVO.java
index af0cace..b701542 100644
--- a/engine/schema/src/com/cloud/dc/ClusterVO.java
+++ b/engine/schema/src/com/cloud/dc/ClusterVO.java
@@ -28,14 +28,12 @@ import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
-import org.apache.cloudstack.api.Identity;
import com.cloud.hypervisor.Hypervisor.HypervisorType;
import com.cloud.org.Cluster;
-import com.cloud.org.Managed.ManagedState;
import com.cloud.org.Grouping;
+import com.cloud.org.Managed.ManagedState;
import com.cloud.utils.NumbersUtil;
import com.cloud.utils.db.GenericDao;
-import org.apache.cloudstack.api.InternalIdentity;
@Entity
@Table(name = "cluster")
@@ -96,22 +94,27 @@ public class ClusterVO implements Cluster {
this.uuid = UUID.randomUUID().toString();
}
+ @Override
public long getId() {
return id;
}
+ @Override
public String getName() {
return name;
}
+ @Override
public long getDataCenterId() {
return dataCenterId;
}
+ @Override
public long getPodId() {
return podId;
}
+ @Override
public Cluster.ClusterType getClusterType() {
return clusterType;
}
@@ -120,6 +123,7 @@ public class ClusterVO implements Cluster {
this.clusterType = clusterType;
}
+ @Override
public AllocationState getAllocationState() {
return allocationState;
}
@@ -128,6 +132,7 @@ public class ClusterVO implements Cluster {
this.allocationState = allocationState;
}
+ @Override
public ManagedState getManagedState() {
return managedState;
}
@@ -154,6 +159,7 @@ public class ClusterVO implements Cluster {
return this.id == that.id;
}
+ @Override
public HypervisorType getHypervisorType() {
return HypervisorType.getType(hypervisorType);
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d620df2b/engine/schema/src/com/cloud/dc/DataCenterIpAddressVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/dc/DataCenterIpAddressVO.java b/engine/schema/src/com/cloud/dc/DataCenterIpAddressVO.java
index 6b9d866..70b4df1 100755
--- a/engine/schema/src/com/cloud/dc/DataCenterIpAddressVO.java
+++ b/engine/schema/src/com/cloud/dc/DataCenterIpAddressVO.java
@@ -16,8 +16,6 @@
// under the License.
package com.cloud.dc;
-import org.apache.cloudstack.api.InternalIdentity;
-
import java.util.Date;
import javax.persistence.Column;
@@ -29,6 +27,8 @@ import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
+import org.apache.cloudstack.api.InternalIdentity;
+
@Entity
@Table(name = "op_dc_ip_address_alloc")
public class DataCenterIpAddressVO implements InternalIdentity {
@@ -77,6 +77,7 @@ public class DataCenterIpAddressVO implements InternalIdentity {
this.podId = podId;
}
+ @Override
public long getId() {
return id;
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d620df2b/engine/schema/src/com/cloud/dc/DataCenterLinkLocalIpAddressVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/dc/DataCenterLinkLocalIpAddressVO.java b/engine/schema/src/com/cloud/dc/DataCenterLinkLocalIpAddressVO.java
index 2f6d96d..31d124c 100644
--- a/engine/schema/src/com/cloud/dc/DataCenterLinkLocalIpAddressVO.java
+++ b/engine/schema/src/com/cloud/dc/DataCenterLinkLocalIpAddressVO.java
@@ -16,8 +16,6 @@
// under the License.
package com.cloud.dc;
-import org.apache.cloudstack.api.InternalIdentity;
-
import java.util.Date;
import javax.persistence.Column;
@@ -29,6 +27,8 @@ import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
+import org.apache.cloudstack.api.InternalIdentity;
+
@Entity
@Table(name = "op_dc_link_local_ip_address_alloc")
public class DataCenterLinkLocalIpAddressVO implements InternalIdentity {
@@ -66,6 +66,7 @@ public class DataCenterLinkLocalIpAddressVO implements InternalIdentity {
this.podId = podId;
}
+ @Override
public long getId() {
return id;
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d620df2b/engine/schema/src/com/cloud/dc/DataCenterVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/dc/DataCenterVO.java b/engine/schema/src/com/cloud/dc/DataCenterVO.java
index b81273b..02aa988 100644
--- a/engine/schema/src/com/cloud/dc/DataCenterVO.java
+++ b/engine/schema/src/com/cloud/dc/DataCenterVO.java
@@ -31,12 +31,10 @@ import javax.persistence.Table;
import javax.persistence.TableGenerator;
import javax.persistence.Transient;
-import org.apache.cloudstack.api.Identity;
import com.cloud.network.Network.Provider;
import com.cloud.org.Grouping;
import com.cloud.utils.NumbersUtil;
import com.cloud.utils.db.GenericDao;
-import org.apache.cloudstack.api.InternalIdentity;
@Entity
@Table(name = "data_center")
@@ -190,8 +188,8 @@ public class DataCenterVO implements DataCenter {
this.uuid = UUID.randomUUID().toString();
}
- public DataCenterVO(String name, String description, String dns1, String dns2, String dns3, String dns4, String guestCidr, String domain, Long domainId, NetworkType zoneType,
- String zoneToken, String domainSuffix, boolean securityGroupEnabled, boolean localStorageEnabled, String ip6Dns1, String ip6Dns2) {
+ public DataCenterVO(String name, String description, String dns1, String dns2, String dns3, String dns4, String guestCidr, String domain, Long domainId,
+ NetworkType zoneType, String zoneToken, String domainSuffix, boolean securityGroupEnabled, boolean localStorageEnabled, String ip6Dns1, String ip6Dns2) {
this.name = name;
this.description = description;
this.dns1 = dns1;
@@ -388,6 +386,7 @@ public class DataCenterVO implements DataCenter {
details.put(name, value);
}
+ @Override
public AllocationState getAllocationState() {
return allocationState;
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d620df2b/engine/schema/src/com/cloud/dc/DataCenterVnetVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/dc/DataCenterVnetVO.java b/engine/schema/src/com/cloud/dc/DataCenterVnetVO.java
index 612a039..d3959df 100755
--- a/engine/schema/src/com/cloud/dc/DataCenterVnetVO.java
+++ b/engine/schema/src/com/cloud/dc/DataCenterVnetVO.java
@@ -16,8 +16,6 @@
// under the License.
package com.cloud.dc;
-import org.apache.cloudstack.api.InternalIdentity;
-
import java.util.Date;
import javax.persistence.Column;
@@ -29,6 +27,8 @@ import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
+import org.apache.cloudstack.api.InternalIdentity;
+
@Entity
@Table(name = "op_dc_vnet_alloc")
public class DataCenterVnetVO implements InternalIdentity {
@@ -75,6 +75,7 @@ public class DataCenterVnetVO implements InternalIdentity {
this.takenAt = null;
}
+ @Override
public long getId() {
return id;
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d620df2b/engine/schema/src/com/cloud/dc/HostPodVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/dc/HostPodVO.java b/engine/schema/src/com/cloud/dc/HostPodVO.java
index f1e79f0..d997181 100644
--- a/engine/schema/src/com/cloud/dc/HostPodVO.java
+++ b/engine/schema/src/com/cloud/dc/HostPodVO.java
@@ -28,11 +28,9 @@ import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
-import org.apache.cloudstack.api.Identity;
import com.cloud.org.Grouping;
import com.cloud.utils.NumbersUtil;
import com.cloud.utils.db.GenericDao;
-import org.apache.cloudstack.api.InternalIdentity;
@Entity
@Table(name = "host_pod_ref")
@@ -96,6 +94,7 @@ public class HostPodVO implements Pod {
return id;
}
+ @Override
public long getDataCenterId() {
return dataCenterId;
}
@@ -104,6 +103,7 @@ public class HostPodVO implements Pod {
this.dataCenterId = dataCenterId;
}
+ @Override
public String getName() {
return name;
}
@@ -139,6 +139,7 @@ public class HostPodVO implements Pod {
this.gateway = gateway;
}
+ @Override
public String getDescription() {
return description;
}
@@ -147,6 +148,7 @@ public class HostPodVO implements Pod {
this.description = description;
}
+ @Override
public AllocationState getAllocationState() {
return allocationState;
}
@@ -165,6 +167,7 @@ public class HostPodVO implements Pod {
return NumbersUtil.hash(id);
}
+ @Override
public boolean getExternalDhcp() {
return externalDhcp;
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d620df2b/engine/schema/src/com/cloud/dc/PodVlanMapVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/dc/PodVlanMapVO.java b/engine/schema/src/com/cloud/dc/PodVlanMapVO.java
index dbbda91..5f84cf2 100644
--- a/engine/schema/src/com/cloud/dc/PodVlanMapVO.java
+++ b/engine/schema/src/com/cloud/dc/PodVlanMapVO.java
@@ -16,8 +16,6 @@
// under the License.
package com.cloud.dc;
-import org.apache.cloudstack.api.InternalIdentity;
-
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
@@ -25,6 +23,8 @@ import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
+import org.apache.cloudstack.api.InternalIdentity;
+
@Entity
@Table(name = "pod_vlan_map")
public class PodVlanMapVO implements InternalIdentity {
@@ -48,6 +48,7 @@ public class PodVlanMapVO implements InternalIdentity {
public PodVlanMapVO() {
}
+ @Override
public long getId() {
return id;
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d620df2b/engine/schema/src/com/cloud/dc/PodVlanVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/dc/PodVlanVO.java b/engine/schema/src/com/cloud/dc/PodVlanVO.java
index 79b8ae0..01668d9 100755
--- a/engine/schema/src/com/cloud/dc/PodVlanVO.java
+++ b/engine/schema/src/com/cloud/dc/PodVlanVO.java
@@ -16,8 +16,6 @@
// under the License.
package com.cloud.dc;
-import org.apache.cloudstack.api.InternalIdentity;
-
import java.util.Date;
import javax.persistence.Column;
@@ -29,6 +27,8 @@ import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
+import org.apache.cloudstack.api.InternalIdentity;
+
@Entity
@Table(name = "op_pod_vlan_alloc")
public class PodVlanVO implements InternalIdentity {
@@ -69,6 +69,7 @@ public class PodVlanVO implements InternalIdentity {
this.takenAt = null;
}
+ @Override
public long getId() {
return id;
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d620df2b/engine/schema/src/com/cloud/dc/StorageNetworkIpAddressVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/dc/StorageNetworkIpAddressVO.java b/engine/schema/src/com/cloud/dc/StorageNetworkIpAddressVO.java
index a828205..d719142 100755
--- a/engine/schema/src/com/cloud/dc/StorageNetworkIpAddressVO.java
+++ b/engine/schema/src/com/cloud/dc/StorageNetworkIpAddressVO.java
@@ -16,8 +16,6 @@
// under the License.
package com.cloud.dc;
-import org.apache.cloudstack.api.InternalIdentity;
-
import java.util.Date;
import javax.persistence.Column;
@@ -32,6 +30,8 @@ import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
+import org.apache.cloudstack.api.InternalIdentity;
+
@Entity
@Table(name = "op_dc_storage_network_ip_address")
@SecondaryTables({@SecondaryTable(name = "dc_storage_network_ip_range", pkJoinColumns = {@PrimaryKeyJoinColumn(name = "range_id", referencedColumnName = "id")})})
@@ -66,6 +66,7 @@ public class StorageNetworkIpAddressVO implements InternalIdentity {
protected StorageNetworkIpAddressVO() {
}
+ @Override
public long getId() {
return id;
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d620df2b/engine/schema/src/com/cloud/dc/StorageNetworkIpRangeVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/dc/StorageNetworkIpRangeVO.java b/engine/schema/src/com/cloud/dc/StorageNetworkIpRangeVO.java
index d09a26e..9b84ac7 100755
--- a/engine/schema/src/com/cloud/dc/StorageNetworkIpRangeVO.java
+++ b/engine/schema/src/com/cloud/dc/StorageNetworkIpRangeVO.java
@@ -16,8 +16,6 @@
// under the License.
package com.cloud.dc;
-import org.apache.cloudstack.api.InternalIdentity;
-
import java.util.UUID;
import javax.persistence.Column;
@@ -33,8 +31,8 @@ import javax.persistence.Table;
@Entity
@Table(name = "dc_storage_network_ip_range")
@SecondaryTables({@SecondaryTable(name = "networks", pkJoinColumns = {@PrimaryKeyJoinColumn(name = "network_id", referencedColumnName = "id")}),
- @SecondaryTable(name = "host_pod_ref", pkJoinColumns = {@PrimaryKeyJoinColumn(name = "pod_id", referencedColumnName = "id")}),
- @SecondaryTable(name = "data_center", pkJoinColumns = {@PrimaryKeyJoinColumn(name = "data_center_id", referencedColumnName = "id")})})
+ @SecondaryTable(name = "host_pod_ref", pkJoinColumns = {@PrimaryKeyJoinColumn(name = "pod_id", referencedColumnName = "id")}),
+ @SecondaryTable(name = "data_center", pkJoinColumns = {@PrimaryKeyJoinColumn(name = "data_center_id", referencedColumnName = "id")})})
public class StorageNetworkIpRangeVO implements StorageNetworkIpRange {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@@ -93,6 +91,7 @@ public class StorageNetworkIpRangeVO implements StorageNetworkIpRange {
this.uuid = UUID.randomUUID().toString();
}
+ @Override
public long getId() {
return id;
}
@@ -121,6 +120,7 @@ public class StorageNetworkIpRangeVO implements StorageNetworkIpRange {
this.networkId = nwId;
}
+ @Override
public Integer getVlan() {
return vlan;
}
@@ -133,6 +133,7 @@ public class StorageNetworkIpRangeVO implements StorageNetworkIpRange {
this.startIp = start;
}
+ @Override
public String getStartIp() {
return startIp;
}
@@ -141,14 +142,17 @@ public class StorageNetworkIpRangeVO implements StorageNetworkIpRange {
this.endIp = end;
}
+ @Override
public String getEndIp() {
return endIp;
}
+ @Override
public String getNetmask() {
return netmask;
}
+ @Override
public String getGateway() {
return this.gateway;
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d620df2b/engine/schema/src/com/cloud/dc/VlanVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/dc/VlanVO.java b/engine/schema/src/com/cloud/dc/VlanVO.java
index 1061c90..ff103b9 100644
--- a/engine/schema/src/com/cloud/dc/VlanVO.java
+++ b/engine/schema/src/com/cloud/dc/VlanVO.java
@@ -27,9 +27,6 @@ import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
-import org.apache.cloudstack.api.Identity;
-import org.apache.cloudstack.api.InternalIdentity;
-
@Entity
@Table(name = "vlan")
public class VlanVO implements Vlan {
@@ -167,23 +164,24 @@ public class VlanVO implements Vlan {
@Override
public String toString() {
if (toString == null) {
- toString = new StringBuilder("Vlan[").append(vlanTag)
- .append("|")
- .append(vlanGateway)
- .append("|")
- .append(vlanNetmask)
- .append("|")
- .append(ip6Gateway)
- .append("|")
- .append(ip6Cidr)
- .append("|")
- .append(ipRange)
- .append("|")
- .append("|")
- .append(ip6Range)
- .append(networkId)
- .append("]")
- .toString();
+ toString =
+ new StringBuilder("Vlan[").append(vlanTag)
+ .append("|")
+ .append(vlanGateway)
+ .append("|")
+ .append(vlanNetmask)
+ .append("|")
+ .append(ip6Gateway)
+ .append("|")
+ .append(ip6Cidr)
+ .append("|")
+ .append(ipRange)
+ .append("|")
+ .append("|")
+ .append(ip6Range)
+ .append(networkId)
+ .append("]")
+ .toString();
}
return toString;
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d620df2b/engine/schema/src/com/cloud/dc/dao/ClusterDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/dc/dao/ClusterDaoImpl.java b/engine/schema/src/com/cloud/dc/dao/ClusterDaoImpl.java
index 17c7785..c0f86f3 100644
--- a/engine/schema/src/com/cloud/dc/dao/ClusterDaoImpl.java
+++ b/engine/schema/src/com/cloud/dc/dao/ClusterDaoImpl.java
@@ -223,7 +223,8 @@ public class ClusterDaoImpl extends GenericDaoBase<ClusterVO, Long> implements C
GenericSearchBuilder<ClusterVO, Long> clusterIdSearch = createSearchBuilder(Long.class);
clusterIdSearch.selectFields(clusterIdSearch.entity().getId());
- clusterIdSearch.join("disabledPodIdSearch", disabledPodIdSearch, clusterIdSearch.entity().getPodId(), disabledPodIdSearch.entity().getId(), JoinBuilder.JoinType.INNER);
+ clusterIdSearch.join("disabledPodIdSearch", disabledPodIdSearch, clusterIdSearch.entity().getPodId(), disabledPodIdSearch.entity().getId(),
+ JoinBuilder.JoinType.INNER);
clusterIdSearch.done();
SearchCriteria<Long> sc = clusterIdSearch.create();
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d620df2b/engine/schema/src/com/cloud/dc/dao/ClusterVSMMapDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/dc/dao/ClusterVSMMapDaoImpl.java b/engine/schema/src/com/cloud/dc/dao/ClusterVSMMapDaoImpl.java
index 1de310f..8c0dbe7 100644
--- a/engine/schema/src/com/cloud/dc/dao/ClusterVSMMapDaoImpl.java
+++ b/engine/schema/src/com/cloud/dc/dao/ClusterVSMMapDaoImpl.java
@@ -17,6 +17,7 @@
package com.cloud.dc.dao;
import java.util.List;
+
import javax.ejb.Local;
import org.springframework.stereotype.Component;
@@ -78,6 +79,7 @@ public class ClusterVSMMapDaoImpl extends GenericDaoBase<ClusterVSMMapVO, Long>
return listBy(sc);
}
+ @Override
public boolean remove(Long id) {
TransactionLegacy txn = TransactionLegacy.currentTxn();
txn.start();
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d620df2b/engine/schema/src/com/cloud/dc/dao/DataCenterDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/dc/dao/DataCenterDaoImpl.java b/engine/schema/src/com/cloud/dc/dao/DataCenterDaoImpl.java
index 335be8b..9c6b553 100755
--- a/engine/schema/src/com/cloud/dc/dao/DataCenterDaoImpl.java
+++ b/engine/schema/src/com/cloud/dc/dao/DataCenterDaoImpl.java
@@ -26,7 +26,6 @@ import javax.inject.Inject;
import javax.naming.ConfigurationException;
import javax.persistence.TableGenerator;
-import org.apache.cloudstack.api.ResourceDetail;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Component;
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d620df2b/engine/schema/src/com/cloud/dc/dao/DataCenterIpAddressDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/dc/dao/DataCenterIpAddressDaoImpl.java b/engine/schema/src/com/cloud/dc/dao/DataCenterIpAddressDaoImpl.java
index 441f3ae..d4fb1b4 100755
--- a/engine/schema/src/com/cloud/dc/dao/DataCenterIpAddressDaoImpl.java
+++ b/engine/schema/src/com/cloud/dc/dao/DataCenterIpAddressDaoImpl.java
@@ -47,6 +47,7 @@ public class DataCenterIpAddressDaoImpl extends GenericDaoBase<DataCenterIpAddre
private final GenericSearchBuilder<DataCenterIpAddressVO, Integer> AllIpCount;
private final GenericSearchBuilder<DataCenterIpAddressVO, Integer> AllAllocatedIpCount;
+ @Override
@DB
public DataCenterIpAddressVO takeIpAddress(long dcId, long podId, long instanceId, String reservationId) {
SearchCriteria<DataCenterIpAddressVO> sc = AllFieldsSearch.create();
@@ -68,6 +69,7 @@ public class DataCenterIpAddressDaoImpl extends GenericDaoBase<DataCenterIpAddre
return vo;
}
+ @Override
@DB
public DataCenterIpAddressVO takeDataCenterIpAddress(long dcId, String reservationId) {
SearchCriteria<DataCenterIpAddressVO> sc = AllFieldsSearch.create();
@@ -107,10 +109,12 @@ public class DataCenterIpAddressDaoImpl extends GenericDaoBase<DataCenterIpAddre
return update(vo, sc) >= 1;
}
+ @Override
@DB
public void addIpRange(long dcId, long podId, String start, String end) {
TransactionLegacy txn = TransactionLegacy.currentTxn();
- String insertSql = "INSERT INTO `cloud`.`op_dc_ip_address_alloc` (ip_address, data_center_id, pod_id, mac_address) VALUES (?, ?, ?, (select mac_address from `cloud`.`data_center` where id=?))";
+ String insertSql =
+ "INSERT INTO `cloud`.`op_dc_ip_address_alloc` (ip_address, data_center_id, pod_id, mac_address) VALUES (?, ?, ?, (select mac_address from `cloud`.`data_center` where id=?))";
String updateSql = "UPDATE `cloud`.`data_center` set mac_address = mac_address+1 where id=?";
PreparedStatement stmt = null;
@@ -139,6 +143,7 @@ public class DataCenterIpAddressDaoImpl extends GenericDaoBase<DataCenterIpAddre
}
}
+ @Override
public void releaseIpAddress(String ipAddress, long dcId, Long instanceId) {
if (s_logger.isDebugEnabled()) {
s_logger.debug("Releasing ip address: " + ipAddress + " data center " + dcId);
@@ -156,6 +161,7 @@ public class DataCenterIpAddressDaoImpl extends GenericDaoBase<DataCenterIpAddre
update(vo, sc);
}
+ @Override
public void releaseIpAddress(long nicId, String reservationId) {
if (s_logger.isDebugEnabled()) {
s_logger.debug("Releasing ip address for reservationId=" + reservationId + ", instance=" + nicId);
@@ -171,6 +177,7 @@ public class DataCenterIpAddressDaoImpl extends GenericDaoBase<DataCenterIpAddre
update(vo, sc);
}
+ @Override
public List<DataCenterIpAddressVO> listByPodIdDcId(long podId, long dcId) {
SearchCriteria<DataCenterIpAddressVO> sc = AllFieldsSearch.create();
sc.setParameters("pod", podId);
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d620df2b/engine/schema/src/com/cloud/dc/dao/DataCenterLinkLocalIpAddressDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/dc/dao/DataCenterLinkLocalIpAddressDaoImpl.java b/engine/schema/src/com/cloud/dc/dao/DataCenterLinkLocalIpAddressDaoImpl.java
index 4348a31..5917123 100644
--- a/engine/schema/src/com/cloud/dc/dao/DataCenterLinkLocalIpAddressDaoImpl.java
+++ b/engine/schema/src/com/cloud/dc/dao/DataCenterLinkLocalIpAddressDaoImpl.java
@@ -49,6 +49,7 @@ public class DataCenterLinkLocalIpAddressDaoImpl extends GenericDaoBase<DataCent
private final GenericSearchBuilder<DataCenterLinkLocalIpAddressVO, Integer> AllIpCount;
private final GenericSearchBuilder<DataCenterLinkLocalIpAddressVO, Integer> AllAllocatedIpCount;
+ @Override
@DB
public DataCenterLinkLocalIpAddressVO takeIpAddress(long dcId, long podId, long instanceId, String reservationId) {
SearchCriteria<DataCenterLinkLocalIpAddressVO> sc = AllFieldsSearch.create();
@@ -71,12 +72,14 @@ public class DataCenterLinkLocalIpAddressDaoImpl extends GenericDaoBase<DataCent
return vo;
}
+ @Override
public boolean deleteIpAddressByPod(long podId) {
SearchCriteria<DataCenterLinkLocalIpAddressVO> sc = AllFieldsSearch.create();
sc.setParameters("pod", podId);
return remove(sc) > 0;
}
+ @Override
@DB
public void addIpRange(long dcId, long podId, String start, String end) {
String insertSql = "INSERT INTO `cloud`.`op_dc_link_local_ip_address_alloc` (ip_address, data_center_id, pod_id) VALUES (?, ?, ?)";
@@ -102,6 +105,7 @@ public class DataCenterLinkLocalIpAddressDaoImpl extends GenericDaoBase<DataCent
}
}
+ @Override
public void releaseIpAddress(String ipAddress, long dcId, long instanceId) {
if (s_logger.isDebugEnabled()) {
s_logger.debug("Releasing ip address: " + ipAddress + " data center " + dcId);
@@ -119,6 +123,7 @@ public class DataCenterLinkLocalIpAddressDaoImpl extends GenericDaoBase<DataCent
update(vo, sc);
}
+ @Override
public void releaseIpAddress(long nicId, String reservationId) {
SearchCriteria<DataCenterLinkLocalIpAddressVO> sc = AllFieldsSearch.create();
sc.setParameters("instance", nicId);
@@ -132,12 +137,14 @@ public class DataCenterLinkLocalIpAddressDaoImpl extends GenericDaoBase<DataCent
update(vo, sc);
}
+ @Override
public List<DataCenterLinkLocalIpAddressVO> listByPodIdDcId(long podId, long dcId) {
SearchCriteria<DataCenterLinkLocalIpAddressVO> sc = AllFieldsSearch.create();
sc.setParameters("pod", podId);
return listBy(sc);
}
+ @Override
public int countIPs(long podId, long dcId, boolean onlyCountAllocated) {
SearchCriteria<Integer> sc;
if (onlyCountAllocated) {
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d620df2b/engine/schema/src/com/cloud/dc/dao/DataCenterVnetDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/dc/dao/DataCenterVnetDao.java b/engine/schema/src/com/cloud/dc/dao/DataCenterVnetDao.java
index 7924439..1783231 100644
--- a/engine/schema/src/com/cloud/dc/dao/DataCenterVnetDao.java
+++ b/engine/schema/src/com/cloud/dc/dao/DataCenterVnetDao.java
@@ -20,7 +20,6 @@ import java.util.List;
import com.cloud.dc.DataCenterVnetVO;
import com.cloud.utils.db.GenericDao;
-import com.cloud.utils.db.Transaction;
import com.cloud.utils.db.TransactionLegacy;
public interface DataCenterVnetDao extends GenericDao<DataCenterVnetVO, Long> {
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d620df2b/engine/schema/src/com/cloud/dc/dao/DataCenterVnetDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/dc/dao/DataCenterVnetDaoImpl.java b/engine/schema/src/com/cloud/dc/dao/DataCenterVnetDaoImpl.java
index 0498b71..3205fcd 100755
--- a/engine/schema/src/com/cloud/dc/dao/DataCenterVnetDaoImpl.java
+++ b/engine/schema/src/com/cloud/dc/dao/DataCenterVnetDaoImpl.java
@@ -67,6 +67,7 @@ public class DataCenterVnetDaoImpl extends GenericDaoBase<DataCenterVnetVO, Long
@Inject
protected AccountGuestVlanMapDao _accountGuestVlanMapDao;
+ @Override
public List<DataCenterVnetVO> listAllocatedVnets(long physicalNetworkId) {
SearchCriteria<DataCenterVnetVO> sc = DcSearchAllocated.create();
sc.setParameters("physicalNetworkId", physicalNetworkId);
@@ -80,6 +81,7 @@ public class DataCenterVnetDaoImpl extends GenericDaoBase<DataCenterVnetVO, Long
return listBy(sc).size();
}
+ @Override
public List<DataCenterVnetVO> listAllocatedVnetsInRange(long dcId, long physicalNetworkId, Integer start, Integer end) {
SearchCriteria<DataCenterVnetVO> sc = DcSearchAllocatedInRange.create();
sc.setParameters("dc", dcId);
@@ -88,6 +90,7 @@ public class DataCenterVnetDaoImpl extends GenericDaoBase<DataCenterVnetVO, Long
return listBy(sc);
}
+ @Override
public void lockRange(long dcId, long physicalNetworkId, Integer start, Integer end) {
SearchCriteria<DataCenterVnetVO> sc = SearchRange.create();
sc.setParameters("dc", dcId);
@@ -96,6 +99,7 @@ public class DataCenterVnetDaoImpl extends GenericDaoBase<DataCenterVnetVO, Long
lockRows(sc, null, true);
}
+ @Override
public List<DataCenterVnetVO> findVnet(long dcId, String vnet) {
SearchCriteria<DataCenterVnetVO> sc = VnetDcSearch.create();
;
@@ -104,12 +108,14 @@ public class DataCenterVnetDaoImpl extends GenericDaoBase<DataCenterVnetVO, Long
return listBy(sc);
}
+ @Override
public int countZoneVlans(long dcId, boolean onlyCountAllocated) {
SearchCriteria<Integer> sc = onlyCountAllocated ? countAllocatedZoneVlans.create() : countZoneVlans.create();
sc.setParameters("dc", dcId);
return customSearch(sc, null).get(0);
}
+ @Override
public List<DataCenterVnetVO> findVnet(long dcId, long physicalNetworkId, String vnet) {
SearchCriteria<DataCenterVnetVO> sc = VnetDcSearch.create();
sc.setParameters("dc", dcId);
@@ -119,6 +125,7 @@ public class DataCenterVnetDaoImpl extends GenericDaoBase<DataCenterVnetVO, Long
return listBy(sc);
}
+ @Override
@DB
//In the List<string> argument each string is a vlan. not a vlanRange.
public
@@ -143,6 +150,7 @@ public class DataCenterVnetDaoImpl extends GenericDaoBase<DataCenterVnetVO, Long
}
//In the List<string> argument each string is a vlan. not a vlanRange.
+ @Override
public void deleteVnets(TransactionLegacy txn, long dcId, long physicalNetworkId, List<String> vnets) {
String deleteVnet = "DELETE FROM `cloud`.`op_dc_vnet_alloc` WHERE data_center_id=? AND physical_network_id=? AND taken IS NULL AND vnet=?";
try {
@@ -159,12 +167,14 @@ public class DataCenterVnetDaoImpl extends GenericDaoBase<DataCenterVnetVO, Long
}
}
+ @Override
public void delete(long physicalNetworkId) {
SearchCriteria<DataCenterVnetVO> sc = VnetDcSearch.create();
sc.setParameters("physicalNetworkId", physicalNetworkId);
remove(sc);
}
+ @Override
@DB
public DataCenterVnetVO take(long physicalNetworkId, long accountId, String reservationId, List<Long> vlanDbIds) {
SearchCriteria<DataCenterVnetVO> sc;
@@ -191,6 +201,7 @@ public class DataCenterVnetDaoImpl extends GenericDaoBase<DataCenterVnetVO, Long
return vo;
}
+ @Override
public void release(String vnet, long physicalNetworkId, long accountId, String reservationId) {
SearchCriteria<DataCenterVnetVO> sc = VnetDcSearchAllocated.create();
sc.setParameters("vnet", vnet);
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d620df2b/engine/schema/src/com/cloud/dc/dao/HostPodDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/dc/dao/HostPodDao.java b/engine/schema/src/com/cloud/dc/dao/HostPodDao.java
index 1babef1..39c8a49 100644
--- a/engine/schema/src/com/cloud/dc/dao/HostPodDao.java
+++ b/engine/schema/src/com/cloud/dc/dao/HostPodDao.java
@@ -21,7 +21,6 @@ import java.util.List;
import com.cloud.dc.HostPodVO;
import com.cloud.utils.db.GenericDao;
-import com.cloud.vm.VirtualMachine;
public interface HostPodDao extends GenericDao<HostPodVO, Long> {
public List<HostPodVO> listByDataCenterId(long id);
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d620df2b/engine/schema/src/com/cloud/dc/dao/PodVlanDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/dc/dao/PodVlanDaoImpl.java b/engine/schema/src/com/cloud/dc/dao/PodVlanDaoImpl.java
index f2e6cba..2b98613 100755
--- a/engine/schema/src/com/cloud/dc/dao/PodVlanDaoImpl.java
+++ b/engine/schema/src/com/cloud/dc/dao/PodVlanDaoImpl.java
@@ -24,7 +24,6 @@ import java.util.List;
import org.springframework.stereotype.Component;
import com.cloud.dc.PodVlanVO;
-import com.cloud.utils.db.GenericDao;
import com.cloud.utils.db.GenericDaoBase;
import com.cloud.utils.db.SearchBuilder;
import com.cloud.utils.db.SearchCriteria;
@@ -40,12 +39,14 @@ public class PodVlanDaoImpl extends GenericDaoBase<PodVlanVO, Long> implements P
private final SearchBuilder<PodVlanVO> VlanPodSearch;
private final SearchBuilder<PodVlanVO> PodSearchAllocated;
+ @Override
public List<PodVlanVO> listAllocatedVnets(long podId) {
SearchCriteria<PodVlanVO> sc = PodSearchAllocated.create();
sc.setParameters("podId", podId);
return listBy(sc);
}
+ @Override
public void add(long podId, int start, int end) {
String insertVnet = "INSERT INTO `cloud`.`op_pod_vlan_alloc` (vlan, pod_id) VALUES ( ?, ?)";
@@ -65,6 +66,7 @@ public class PodVlanDaoImpl extends GenericDaoBase<PodVlanVO, Long> implements P
}
}
+ @Override
public void delete(long podId) {
String deleteVnet = "DELETE FROM `cloud`.`op_pod_vlan_alloc` WHERE pod_id = ?";
@@ -78,6 +80,7 @@ public class PodVlanDaoImpl extends GenericDaoBase<PodVlanVO, Long> implements P
}
}
+ @Override
public PodVlanVO take(long podId, long accountId) {
SearchCriteria<PodVlanVO> sc = FreeVlanSearch.create();
sc.setParameters("podId", podId);
@@ -101,6 +104,7 @@ public class PodVlanDaoImpl extends GenericDaoBase<PodVlanVO, Long> implements P
}
}
+ @Override
public void release(String vlan, long podId, long accountId) {
SearchCriteria<PodVlanVO> sc = VlanPodSearch.create();
sc.setParameters("vlan", vlan);
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d620df2b/engine/schema/src/com/cloud/dc/dao/StorageNetworkIpAddressDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/dc/dao/StorageNetworkIpAddressDaoImpl.java b/engine/schema/src/com/cloud/dc/dao/StorageNetworkIpAddressDaoImpl.java
index f693464..2e7381c 100755
--- a/engine/schema/src/com/cloud/dc/dao/StorageNetworkIpAddressDaoImpl.java
+++ b/engine/schema/src/com/cloud/dc/dao/StorageNetworkIpAddressDaoImpl.java
@@ -29,8 +29,6 @@ import com.cloud.utils.db.GenericDaoBase;
import com.cloud.utils.db.GenericSearchBuilder;
import com.cloud.utils.db.SearchBuilder;
import com.cloud.utils.db.SearchCriteria;
-import com.cloud.utils.db.GenericQueryBuilder;
-import com.cloud.utils.db.TransactionLegacy;
import com.cloud.utils.db.SearchCriteria.Func;
import com.cloud.utils.db.SearchCriteria.Op;
import com.cloud.utils.db.TransactionLegacy;
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d620df2b/engine/schema/src/com/cloud/dc/dao/VlanDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/dc/dao/VlanDao.java b/engine/schema/src/com/cloud/dc/dao/VlanDao.java
index 9295586..485593e 100755
--- a/engine/schema/src/com/cloud/dc/dao/VlanDao.java
+++ b/engine/schema/src/com/cloud/dc/dao/VlanDao.java
@@ -16,13 +16,13 @@
// under the License.
package com.cloud.dc.dao;
+import java.util.List;
+
import com.cloud.dc.Vlan;
import com.cloud.dc.Vlan.VlanType;
import com.cloud.dc.VlanVO;
import com.cloud.utils.db.GenericDao;
-import java.util.List;
-
public interface VlanDao extends GenericDao<VlanVO, Long> {
VlanVO findByZoneAndVlanId(long zoneId, String vlanId);
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d620df2b/engine/schema/src/com/cloud/dc/dao/VlanDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/dc/dao/VlanDaoImpl.java b/engine/schema/src/com/cloud/dc/dao/VlanDaoImpl.java
index 0bd8d3a..a38a96e 100755
--- a/engine/schema/src/com/cloud/dc/dao/VlanDaoImpl.java
+++ b/engine/schema/src/com/cloud/dc/dao/VlanDaoImpl.java
@@ -16,6 +16,19 @@
// under the License.
package com.cloud.dc.dao;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import javax.ejb.Local;
+import javax.inject.Inject;
+import javax.naming.ConfigurationException;
+
+import org.springframework.stereotype.Component;
+
import com.cloud.dc.AccountVlanMapVO;
import com.cloud.dc.PodVlanMapVO;
import com.cloud.dc.Vlan;
@@ -30,23 +43,13 @@ import com.cloud.utils.db.SearchBuilder;
import com.cloud.utils.db.SearchCriteria;
import com.cloud.utils.db.TransactionLegacy;
import com.cloud.utils.exception.CloudRuntimeException;
-import org.springframework.stereotype.Component;
-
-import javax.ejb.Local;
-import javax.inject.Inject;
-import javax.naming.ConfigurationException;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
@Component
@Local(value = {VlanDao.class})
public class VlanDaoImpl extends GenericDaoBase<VlanVO, Long> implements VlanDao {
- private final String FindZoneWideVlans = "SELECT * FROM vlan WHERE data_center_id=? and vlan_type=? and vlan_id!=? and id not in (select vlan_db_id from account_vlan_map)";
+ private final String FindZoneWideVlans =
+ "SELECT * FROM vlan WHERE data_center_id=? and vlan_type=? and vlan_id!=? and id not in (select vlan_db_id from account_vlan_map)";
protected SearchBuilder<VlanVO> ZoneVlanIdSearch;
protected SearchBuilder<VlanVO> ZoneSearch;
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d620df2b/engine/schema/src/com/cloud/domain/DomainVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/domain/DomainVO.java b/engine/schema/src/com/cloud/domain/DomainVO.java
index 68261e5..f6494b3 100644
--- a/engine/schema/src/com/cloud/domain/DomainVO.java
+++ b/engine/schema/src/com/cloud/domain/DomainVO.java
@@ -26,10 +26,8 @@ import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
-import org.apache.cloudstack.api.InternalIdentity;
import org.apache.log4j.Logger;
-import org.apache.cloudstack.api.Identity;
import com.cloud.utils.db.GenericDao;
@Entity
@@ -113,10 +111,10 @@ public class DomainVO implements Domain {
@Override
public void setParent(Long parent) {
if (parent == null) {
- this.parent = DomainVO.ROOT_DOMAIN;
+ this.parent = Domain.ROOT_DOMAIN;
} else {
- if (parent.longValue() <= DomainVO.ROOT_DOMAIN)
- this.parent = DomainVO.ROOT_DOMAIN;
+ if (parent.longValue() <= Domain.ROOT_DOMAIN)
+ this.parent = Domain.ROOT_DOMAIN;
else
this.parent = parent;
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d620df2b/engine/schema/src/com/cloud/domain/dao/DomainDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/domain/dao/DomainDaoImpl.java b/engine/schema/src/com/cloud/domain/dao/DomainDaoImpl.java
index 7c1f33c..e02daf1 100644
--- a/engine/schema/src/com/cloud/domain/dao/DomainDaoImpl.java
+++ b/engine/schema/src/com/cloud/domain/dao/DomainDaoImpl.java
@@ -105,8 +105,8 @@ public class DomainDaoImpl extends GenericDaoBase<DomainVO, Long> implements Dom
throw new IllegalArgumentException("Domain name is null. Please specify a valid domain name.");
}
- long parent = DomainVO.ROOT_DOMAIN;
- if (domain.getParent() != null && domain.getParent().longValue() >= DomainVO.ROOT_DOMAIN) {
+ long parent = Domain.ROOT_DOMAIN;
+ if (domain.getParent() != null && domain.getParent().longValue() >= Domain.ROOT_DOMAIN) {
parent = domain.getParent().longValue();
}
@@ -147,7 +147,7 @@ public class DomainDaoImpl extends GenericDaoBase<DomainVO, Long> implements Dom
@DB
public boolean remove(Long id) {
// check for any active users / domains assigned to the given domain id and don't remove the domain if there are any
- if (id != null && id.longValue() == DomainVO.ROOT_DOMAIN) {
+ if (id != null && id.longValue() == Domain.ROOT_DOMAIN) {
s_logger.error("Can not remove domain " + id + " as it is ROOT domain");
return false;
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d620df2b/engine/schema/src/com/cloud/event/EventVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/event/EventVO.java b/engine/schema/src/com/cloud/event/EventVO.java
index 6f99d1c..487ba84 100644
--- a/engine/schema/src/com/cloud/event/EventVO.java
+++ b/engine/schema/src/com/cloud/event/EventVO.java
@@ -87,6 +87,7 @@ public class EventVO implements Event {
this.uuid = UUID.randomUUID().toString();
}
+ @Override
public long getId() {
return id;
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d620df2b/engine/schema/src/com/cloud/event/UsageEventVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/event/UsageEventVO.java b/engine/schema/src/com/cloud/event/UsageEventVO.java
index 7b4a99e..719a79b 100644
--- a/engine/schema/src/com/cloud/event/UsageEventVO.java
+++ b/engine/schema/src/com/cloud/event/UsageEventVO.java
@@ -26,7 +26,6 @@ import javax.persistence.Id;
import javax.persistence.Table;
import com.cloud.utils.db.GenericDao;
-import org.apache.cloudstack.api.InternalIdentity;
@Entity
@Table(name = "usage_event")
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d620df2b/engine/schema/src/com/cloud/event/dao/EventDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/event/dao/EventDaoImpl.java b/engine/schema/src/com/cloud/event/dao/EventDaoImpl.java
index 5306e4d..be589e7 100644
--- a/engine/schema/src/com/cloud/event/dao/EventDaoImpl.java
+++ b/engine/schema/src/com/cloud/event/dao/EventDaoImpl.java
@@ -30,8 +30,8 @@ import com.cloud.utils.db.Filter;
import com.cloud.utils.db.GenericDaoBase;
import com.cloud.utils.db.SearchBuilder;
import com.cloud.utils.db.SearchCriteria;
-import com.cloud.utils.db.TransactionLegacy;
import com.cloud.utils.db.SearchCriteria.Op;
+import com.cloud.utils.db.TransactionLegacy;
@Component
@Local(value = {EventDao.class})
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d620df2b/engine/schema/src/com/cloud/event/dao/UsageEventDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/event/dao/UsageEventDaoImpl.java b/engine/schema/src/com/cloud/event/dao/UsageEventDaoImpl.java
index 50b6bb0..f9261a9 100644
--- a/engine/schema/src/com/cloud/event/dao/UsageEventDaoImpl.java
+++ b/engine/schema/src/com/cloud/event/dao/UsageEventDaoImpl.java
@@ -48,10 +48,12 @@ public class UsageEventDaoImpl extends GenericDaoBase<UsageEventVO, Long> implem
private final SearchBuilder<UsageEventVO> latestEventsSearch;
private final SearchBuilder<UsageEventVO> IpeventsSearch;
- private static final String COPY_EVENTS = "INSERT INTO cloud_usage.usage_event (id, type, account_id, created, zone_id, resource_id, resource_name, offering_id, template_id, size, resource_type, virtual_size) "
- + "SELECT id, type, account_id, created, zone_id, resource_id, resource_name, offering_id, template_id, size, resource_type, virtual_size FROM cloud.usage_event vmevt WHERE vmevt.id > ? and vmevt.id <= ? ";
- private static final String COPY_ALL_EVENTS = "INSERT INTO cloud_usage.usage_event (id, type, account_id, created, zone_id, resource_id, resource_name, offering_id, template_id, size, resource_type, virtual_size) "
- + "SELECT id, type, account_id, created, zone_id, resource_id, resource_name, offering_id, template_id, size, resource_type, virtual_size FROM cloud.usage_event vmevt WHERE vmevt.id <= ?";
+ private static final String COPY_EVENTS =
+ "INSERT INTO cloud_usage.usage_event (id, type, account_id, created, zone_id, resource_id, resource_name, offering_id, template_id, size, resource_type, virtual_size) "
+ + "SELECT id, type, account_id, created, zone_id, resource_id, resource_name, offering_id, template_id, size, resource_type, virtual_size FROM cloud.usage_event vmevt WHERE vmevt.id > ? and vmevt.id <= ? ";
+ private static final String COPY_ALL_EVENTS =
+ "INSERT INTO cloud_usage.usage_event (id, type, account_id, created, zone_id, resource_id, resource_name, offering_id, template_id, size, resource_type, virtual_size) "
+ + "SELECT id, type, account_id, created, zone_id, resource_id, resource_name, offering_id, template_id, size, resource_type, virtual_size FROM cloud.usage_event vmevt WHERE vmevt.id <= ?";
private static final String MAX_EVENT = "select max(id) from cloud.usage_event where created <= ?";
@Inject
protected UsageEventDetailsDao usageEventDetailsDao;
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d620df2b/engine/schema/src/com/cloud/event/dao/UsageEventDetailsDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/event/dao/UsageEventDetailsDaoImpl.java b/engine/schema/src/com/cloud/event/dao/UsageEventDetailsDaoImpl.java
index cbd92b6..b2be1c9 100644
--- a/engine/schema/src/com/cloud/event/dao/UsageEventDetailsDaoImpl.java
+++ b/engine/schema/src/com/cloud/event/dao/UsageEventDetailsDaoImpl.java
@@ -16,18 +16,20 @@
// under the License.
package com.cloud.event.dao;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.ejb.Local;
+
+import org.apache.log4j.Logger;
+import org.springframework.stereotype.Component;
+
import com.cloud.event.UsageEventDetailsVO;
import com.cloud.utils.db.GenericDaoBase;
import com.cloud.utils.db.SearchBuilder;
import com.cloud.utils.db.SearchCriteria;
import com.cloud.utils.db.TransactionLegacy;
-import org.apache.log4j.Logger;
-import org.springframework.stereotype.Component;
-
-import javax.ejb.Local;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
@Component
@Local(value = {UsageEventDetailsDao.class})