From 98b27a409dd6842d2c59f99fa746b8dbcea80081 Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Fri, 13 Sep 2024 15:06:33 +0530 Subject: [PATCH] engine-schema: fix get host type count searchcriteria Signed-off-by: Abhishek Kumar --- .../src/main/java/com/cloud/host/dao/HostDaoImpl.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/engine/schema/src/main/java/com/cloud/host/dao/HostDaoImpl.java b/engine/schema/src/main/java/com/cloud/host/dao/HostDaoImpl.java index 2ffdc3585a4..194cacfce99 100644 --- a/engine/schema/src/main/java/com/cloud/host/dao/HostDaoImpl.java +++ b/engine/schema/src/main/java/com/cloud/host/dao/HostDaoImpl.java @@ -183,6 +183,8 @@ public class HostDaoImpl extends GenericDaoBase implements HostDao HostTypeCountSearch = createSearchBuilder(); HostTypeCountSearch.and("type", HostTypeCountSearch.entity().getType(), SearchCriteria.Op.EQ); + HostTypeCountSearch.and("zoneId", HostTypeCountSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ); + HostTypeCountSearch.and("resourceState", HostTypeCountSearch.entity().getResourceState(), SearchCriteria.Op.EQ); HostTypeCountSearch.done(); ResponsibleMsCountSearch = createSearchBuilder(); @@ -500,7 +502,7 @@ public class HostDaoImpl extends GenericDaoBase implements HostDao public Integer countAllByTypeInZone(long zoneId, Type type) { SearchCriteria sc = HostTypeCountSearch.create(); sc.setParameters("type", type); - sc.setParameters("dc", zoneId); + sc.setParameters("zoneId", zoneId); return getCount(sc); } @@ -509,7 +511,7 @@ public class HostDaoImpl extends GenericDaoBase implements HostDao SearchCriteria sc = HostTypeCountSearch.create(); sc.setParameters("type", Type.Routing); sc.setParameters("resourceState", ResourceState.Enabled); - sc.setParameters("dc", zoneId); + sc.setParameters("zoneId", zoneId); return getCount(sc); }