Skip to content

Commit fa5f388

Browse files
author
Boris Schrijver
committed
Updated Dao classes with correct field names.
1 parent b31e64d commit fa5f388

4 files changed

Lines changed: 17 additions & 3 deletions

File tree

‎engine/schema/src/com/cloud/dc/dao/DataCenterIpAddressDaoImpl.java‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ public class DataCenterIpAddressDaoImpl extends GenericDaoBase<DataCenterIpAddre
4545

4646
private final SearchBuilder<DataCenterIpAddressVO> AllFieldsSearch;
4747
private final GenericSearchBuilder<DataCenterIpAddressVO, Integer> AllIpCount;
48+
private final GenericSearchBuilder<DataCenterIpAddressVO, Integer> AllIpCountForDc;
4849
private final GenericSearchBuilder<DataCenterIpAddressVO, Integer> AllAllocatedIpCount;
4950
private final GenericSearchBuilder<DataCenterIpAddressVO, Integer> AllAllocatedIpCountForDc;
5051

@@ -228,7 +229,7 @@ public int countIPs(long dcId, boolean onlyCountAllocated) {
228229
if (onlyCountAllocated) {
229230
sc = AllAllocatedIpCountForDc.create();
230231
} else {
231-
sc = AllIpCount.create();
232+
sc = AllIpCountForDc.create();
232233
}
233234

234235
sc.setParameters("data_center_id", dcId);
@@ -254,6 +255,11 @@ public DataCenterIpAddressDaoImpl() {
254255
AllIpCount.and("pod", AllIpCount.entity().getPodId(), SearchCriteria.Op.EQ);
255256
AllIpCount.done();
256257

258+
AllIpCountForDc = createSearchBuilder(Integer.class);
259+
AllIpCountForDc.select(null, Func.COUNT, AllIpCountForDc.entity().getId());
260+
AllIpCountForDc.and("data_center_id", AllIpCountForDc.entity().getPodId(), SearchCriteria.Op.EQ);
261+
AllIpCountForDc.done();
262+
257263
AllAllocatedIpCount = createSearchBuilder(Integer.class);
258264
AllAllocatedIpCount.select(null, Func.COUNT, AllAllocatedIpCount.entity().getId());
259265
AllAllocatedIpCount.and("pod", AllAllocatedIpCount.entity().getPodId(), SearchCriteria.Op.EQ);

‎engine/schema/src/com/cloud/network/dao/IPAddressDaoImpl.java‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ public class IPAddressDaoImpl extends GenericDaoBase<IPAddressVO, Long> implemen
5555
protected SearchBuilder<IPAddressVO> AllFieldsSearch;
5656
protected SearchBuilder<IPAddressVO> VlanDbIdSearchUnallocated;
5757
protected GenericSearchBuilder<IPAddressVO, Integer> AllIpCount;
58+
protected GenericSearchBuilder<IPAddressVO, Integer> AllIpCountForDc;
5859
protected GenericSearchBuilder<IPAddressVO, Integer> AllocatedIpCount;
5960
protected GenericSearchBuilder<IPAddressVO, Integer> AllocatedIpCountForDc;
6061
protected GenericSearchBuilder<IPAddressVO, Integer> AllIpCountForDashboard;
@@ -101,6 +102,11 @@ public void init() {
101102
AllIpCount.and("vlan", AllIpCount.entity().getVlanId(), Op.EQ);
102103
AllIpCount.done();
103104

105+
AllIpCountForDc = createSearchBuilder(Integer.class);
106+
AllIpCountForDc.select(null, Func.COUNT, AllIpCountForDc.entity().getAddress());
107+
AllIpCountForDc.and("dc", AllIpCountForDc.entity().getDataCenterId(), Op.EQ);
108+
AllIpCountForDc.done();
109+
104110
AllocatedIpCount = createSearchBuilder(Integer.class);
105111
AllocatedIpCount.select(null, Func.COUNT, AllocatedIpCount.entity().getAddress());
106112
AllocatedIpCount.and("dc", AllocatedIpCount.entity().getDataCenterId(), Op.EQ);
@@ -290,7 +296,7 @@ public IPAddressVO findByVmIp(String vmIp) {
290296

291297
@Override
292298
public int countIPs(long dcId, boolean onlyCountAllocated) {
293-
SearchCriteria<Integer> sc = onlyCountAllocated ? AllocatedIpCount.create() : AllIpCount.create();
299+
SearchCriteria<Integer> sc = onlyCountAllocated ? AllocatedIpCountForDc.create() : AllIpCountForDc.create();
294300
sc.setParameters("dc", dcId);
295301

296302
return customSearch(sc, null).get(0);

‎engine/schema/src/com/cloud/storage/dao/VolumeDaoImpl.java‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ public List<VolumeVO> findByPod(long podId) {
200200
@Override
201201
public List<VolumeVO> findByDc(long dcId) {
202202
SearchCriteria<VolumeVO> sc = AllFieldsSearch.create();
203-
sc.setParameters("data_center_id", dcId);
203+
sc.setParameters("dcId", dcId);
204204

205205
return listBy(sc);
206206
}
@@ -322,6 +322,7 @@ public VolumeDaoImpl() {
322322
AllFieldsSearch = createSearchBuilder();
323323
AllFieldsSearch.and("state", AllFieldsSearch.entity().getState(), Op.EQ);
324324
AllFieldsSearch.and("accountId", AllFieldsSearch.entity().getAccountId(), Op.EQ);
325+
AllFieldsSearch.and("dcId", AllFieldsSearch.entity().getDataCenterId(), Op.EQ);
325326
AllFieldsSearch.and("pod", AllFieldsSearch.entity().getPodId(), Op.EQ);
326327
AllFieldsSearch.and("instanceId", AllFieldsSearch.entity().getInstanceId(), Op.EQ);
327328
AllFieldsSearch.and("deviceId", AllFieldsSearch.entity().getDeviceId(), Op.EQ);

‎engine/schema/src/com/cloud/vm/dao/VMInstanceDaoImpl.java‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ protected void init() {
155155
AllFieldsSearch.and("lastHost", AllFieldsSearch.entity().getLastHostId(), Op.EQ);
156156
AllFieldsSearch.and("state", AllFieldsSearch.entity().getState(), Op.EQ);
157157
AllFieldsSearch.and("zone", AllFieldsSearch.entity().getDataCenterId(), Op.EQ);
158+
AllFieldsSearch.and("pod", AllFieldsSearch.entity().getPodIdToDeployIn(), Op.EQ);
158159
AllFieldsSearch.and("type", AllFieldsSearch.entity().getType(), Op.EQ);
159160
AllFieldsSearch.and("account", AllFieldsSearch.entity().getAccountId(), Op.EQ);
160161
AllFieldsSearch.done();

0 commit comments

Comments
 (0)