diff --git a/engine/schema/src/com/cloud/dc/dao/DataCenterIpAddressDaoImpl.java b/engine/schema/src/com/cloud/dc/dao/DataCenterIpAddressDaoImpl.java index cf683226f0b..9486650e90b 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 AllFieldsSearch; private final GenericSearchBuilder AllIpCount; + private final GenericSearchBuilder AllIpCountForDc; private final GenericSearchBuilder AllAllocatedIpCount; private final GenericSearchBuilder AllAllocatedIpCountForDc; @@ -228,7 +229,7 @@ public class DataCenterIpAddressDaoImpl extends GenericDaoBase implemen protected SearchBuilder AllFieldsSearch; protected SearchBuilder VlanDbIdSearchUnallocated; protected GenericSearchBuilder AllIpCount; + protected GenericSearchBuilder AllIpCountForDc; protected GenericSearchBuilder AllocatedIpCount; protected GenericSearchBuilder AllocatedIpCountForDc; protected GenericSearchBuilder AllIpCountForDashboard; @@ -101,6 +102,11 @@ public class IPAddressDaoImpl extends GenericDaoBase 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 implemen @Override public int countIPs(long dcId, boolean onlyCountAllocated) { - SearchCriteria sc = onlyCountAllocated ? AllocatedIpCount.create() : AllIpCount.create(); + SearchCriteria sc = onlyCountAllocated ? AllocatedIpCountForDc.create() : AllIpCountForDc.create(); sc.setParameters("dc", dcId); return customSearch(sc, null).get(0); diff --git a/engine/schema/src/com/cloud/storage/dao/VolumeDaoImpl.java b/engine/schema/src/com/cloud/storage/dao/VolumeDaoImpl.java index 7d0c9c31242..f5738477540 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 implements Vol @Override public List findByDc(long dcId) { SearchCriteria 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 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); diff --git a/engine/schema/src/com/cloud/vm/dao/VMInstanceDaoImpl.java b/engine/schema/src/com/cloud/vm/dao/VMInstanceDaoImpl.java index be0e3668e7a..427c534a094 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 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();