Updated Dao classes with correct field names.
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/fa5f388f Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/fa5f388f Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/fa5f388f Branch: refs/heads/master Commit: fa5f388fe91bc2fd477b1f6752c2a31ac69d5051 Parents: b31e64d Author: Boris Schrijver <[email protected]> Authored: Thu Sep 17 10:54:26 2015 +0200 Committer: Boris Schrijver <[email protected]> Committed: Thu Sep 17 15:54:29 2015 +0200 ---------------------------------------------------------------------- .../src/com/cloud/dc/dao/DataCenterIpAddressDaoImpl.java | 8 +++++++- .../schema/src/com/cloud/network/dao/IPAddressDaoImpl.java | 8 +++++++- engine/schema/src/com/cloud/storage/dao/VolumeDaoImpl.java | 3 ++- engine/schema/src/com/cloud/vm/dao/VMInstanceDaoImpl.java | 1 + 4 files changed, 17 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/fa5f388f/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 cf68322..9486650 100644 --- a/engine/schema/src/com/cloud/dc/dao/DataCenterIpAddressDaoImpl.java +++ b/engine/schema/src/com/cloud/dc/dao/DataCenterIpAddressDaoImpl.java @@ -45,6 +45,7 @@ public class DataCenterIpAddressDaoImpl extends GenericDaoBase<DataCenterIpAddre private final SearchBuilder<DataCenterIpAddressVO> AllFieldsSearch; private final GenericSearchBuilder<DataCenterIpAddressVO, Integer> AllIpCount; + private final GenericSearchBuilder<DataCenterIpAddressVO, Integer> AllIpCountForDc; private final GenericSearchBuilder<DataCenterIpAddressVO, Integer> AllAllocatedIpCount; private final GenericSearchBuilder<DataCenterIpAddressVO, Integer> AllAllocatedIpCountForDc; @@ -228,7 +229,7 @@ public class DataCenterIpAddressDaoImpl extends GenericDaoBase<DataCenterIpAddre if (onlyCountAllocated) { sc = AllAllocatedIpCountForDc.create(); } else { - sc = AllIpCount.create(); + sc = AllIpCountForDc.create(); } sc.setParameters("data_center_id", dcId); @@ -254,6 +255,11 @@ public class DataCenterIpAddressDaoImpl extends GenericDaoBase<DataCenterIpAddre AllIpCount.and("pod", AllIpCount.entity().getPodId(), SearchCriteria.Op.EQ); AllIpCount.done(); + AllIpCountForDc = createSearchBuilder(Integer.class); + AllIpCountForDc.select(null, Func.COUNT, AllIpCountForDc.entity().getId()); + AllIpCountForDc.and("data_center_id", AllIpCountForDc.entity().getPodId(), SearchCriteria.Op.EQ); + AllIpCountForDc.done(); + AllAllocatedIpCount = createSearchBuilder(Integer.class); AllAllocatedIpCount.select(null, Func.COUNT, AllAllocatedIpCount.entity().getId()); AllAllocatedIpCount.and("pod", AllAllocatedIpCount.entity().getPodId(), SearchCriteria.Op.EQ); http://git-wip-us.apache.org/repos/asf/cloudstack/blob/fa5f388f/engine/schema/src/com/cloud/network/dao/IPAddressDaoImpl.java ---------------------------------------------------------------------- diff --git a/engine/schema/src/com/cloud/network/dao/IPAddressDaoImpl.java b/engine/schema/src/com/cloud/network/dao/IPAddressDaoImpl.java index 5c8b9b1..61bc1b7 100644 --- a/engine/schema/src/com/cloud/network/dao/IPAddressDaoImpl.java +++ b/engine/schema/src/com/cloud/network/dao/IPAddressDaoImpl.java @@ -55,6 +55,7 @@ public class IPAddressDaoImpl extends GenericDaoBase<IPAddressVO, Long> implemen protected SearchBuilder<IPAddressVO> AllFieldsSearch; protected SearchBuilder<IPAddressVO> VlanDbIdSearchUnallocated; protected GenericSearchBuilder<IPAddressVO, Integer> AllIpCount; + protected GenericSearchBuilder<IPAddressVO, Integer> AllIpCountForDc; protected GenericSearchBuilder<IPAddressVO, Integer> AllocatedIpCount; protected GenericSearchBuilder<IPAddressVO, Integer> AllocatedIpCountForDc; protected GenericSearchBuilder<IPAddressVO, Integer> AllIpCountForDashboard; @@ -101,6 +102,11 @@ public class IPAddressDaoImpl extends GenericDaoBase<IPAddressVO, Long> implemen AllIpCount.and("vlan", AllIpCount.entity().getVlanId(), Op.EQ); AllIpCount.done(); + AllIpCountForDc = createSearchBuilder(Integer.class); + AllIpCountForDc.select(null, Func.COUNT, AllIpCountForDc.entity().getAddress()); + AllIpCountForDc.and("dc", AllIpCountForDc.entity().getDataCenterId(), Op.EQ); + AllIpCountForDc.done(); + AllocatedIpCount = createSearchBuilder(Integer.class); AllocatedIpCount.select(null, Func.COUNT, AllocatedIpCount.entity().getAddress()); AllocatedIpCount.and("dc", AllocatedIpCount.entity().getDataCenterId(), Op.EQ); @@ -290,7 +296,7 @@ public class IPAddressDaoImpl extends GenericDaoBase<IPAddressVO, Long> implemen @Override public int countIPs(long dcId, boolean onlyCountAllocated) { - SearchCriteria<Integer> sc = onlyCountAllocated ? AllocatedIpCount.create() : AllIpCount.create(); + SearchCriteria<Integer> sc = onlyCountAllocated ? AllocatedIpCountForDc.create() : AllIpCountForDc.create(); sc.setParameters("dc", dcId); return customSearch(sc, null).get(0); http://git-wip-us.apache.org/repos/asf/cloudstack/blob/fa5f388f/engine/schema/src/com/cloud/storage/dao/VolumeDaoImpl.java ---------------------------------------------------------------------- diff --git a/engine/schema/src/com/cloud/storage/dao/VolumeDaoImpl.java b/engine/schema/src/com/cloud/storage/dao/VolumeDaoImpl.java index 7d0c9c3..f573847 100644 --- a/engine/schema/src/com/cloud/storage/dao/VolumeDaoImpl.java +++ b/engine/schema/src/com/cloud/storage/dao/VolumeDaoImpl.java @@ -200,7 +200,7 @@ public class VolumeDaoImpl extends GenericDaoBase<VolumeVO, Long> implements Vol @Override public List<VolumeVO> findByDc(long dcId) { SearchCriteria<VolumeVO> sc = AllFieldsSearch.create(); - sc.setParameters("data_center_id", dcId); + sc.setParameters("dcId", dcId); return listBy(sc); } @@ -322,6 +322,7 @@ public class VolumeDaoImpl extends GenericDaoBase<VolumeVO, Long> implements Vol AllFieldsSearch = createSearchBuilder(); AllFieldsSearch.and("state", AllFieldsSearch.entity().getState(), Op.EQ); AllFieldsSearch.and("accountId", AllFieldsSearch.entity().getAccountId(), Op.EQ); + AllFieldsSearch.and("dcId", AllFieldsSearch.entity().getDataCenterId(), Op.EQ); AllFieldsSearch.and("pod", AllFieldsSearch.entity().getPodId(), Op.EQ); AllFieldsSearch.and("instanceId", AllFieldsSearch.entity().getInstanceId(), Op.EQ); AllFieldsSearch.and("deviceId", AllFieldsSearch.entity().getDeviceId(), Op.EQ); http://git-wip-us.apache.org/repos/asf/cloudstack/blob/fa5f388f/engine/schema/src/com/cloud/vm/dao/VMInstanceDaoImpl.java ---------------------------------------------------------------------- diff --git a/engine/schema/src/com/cloud/vm/dao/VMInstanceDaoImpl.java b/engine/schema/src/com/cloud/vm/dao/VMInstanceDaoImpl.java index be0e366..427c534 100644 --- a/engine/schema/src/com/cloud/vm/dao/VMInstanceDaoImpl.java +++ b/engine/schema/src/com/cloud/vm/dao/VMInstanceDaoImpl.java @@ -155,6 +155,7 @@ public class VMInstanceDaoImpl extends GenericDaoBase<VMInstanceVO, Long> implem AllFieldsSearch.and("lastHost", AllFieldsSearch.entity().getLastHostId(), Op.EQ); AllFieldsSearch.and("state", AllFieldsSearch.entity().getState(), Op.EQ); AllFieldsSearch.and("zone", AllFieldsSearch.entity().getDataCenterId(), Op.EQ); + AllFieldsSearch.and("pod", AllFieldsSearch.entity().getPodIdToDeployIn(), Op.EQ); AllFieldsSearch.and("type", AllFieldsSearch.entity().getType(), Op.EQ); AllFieldsSearch.and("account", AllFieldsSearch.entity().getAccountId(), Op.EQ); AllFieldsSearch.done();
