@@ -105,6 +105,7 @@ public class HostDaoImpl extends GenericDaoBase<HostVO, Long> implements HostDao
105105 protected SearchBuilder <HostVO > UnmanagedDirectConnectSearch ;
106106 protected SearchBuilder <HostVO > UnmanagedApplianceSearch ;
107107 protected SearchBuilder <HostVO > MaintenanceCountSearch ;
108+ protected SearchBuilder <HostVO > HostTypeCountSearch ;
108109 protected SearchBuilder <HostVO > ClusterStatusSearch ;
109110 protected SearchBuilder <HostVO > TypeNameZoneSearch ;
110111 protected SearchBuilder <HostVO > AvailHypevisorInZone ;
@@ -159,6 +160,11 @@ public void init() {
159160 MaintenanceCountSearch .and ("resourceState" , MaintenanceCountSearch .entity ().getResourceState (), SearchCriteria .Op .IN );
160161 MaintenanceCountSearch .done ();
161162
163+ HostTypeCountSearch = createSearchBuilder ();
164+ HostTypeCountSearch .and ("type" , HostTypeCountSearch .entity ().getType (), SearchCriteria .Op .EQ );
165+ HostTypeCountSearch .and ("removed" , HostTypeCountSearch .entity ().getRemoved (), SearchCriteria .Op .NULL );
166+ HostTypeCountSearch .done ();
167+
162168 TypePodDcStatusSearch = createSearchBuilder ();
163169 HostVO entity = TypePodDcStatusSearch .entity ();
164170 TypePodDcStatusSearch .and ("type" , entity .getType (), SearchCriteria .Op .EQ );
@@ -429,6 +435,13 @@ public long countBy(long clusterId, ResourceState... states) {
429435 return hosts .size ();
430436 }
431437
438+ @ Override
439+ public Integer countAllByType (final Host .Type type ) {
440+ SearchCriteria <HostVO > sc = HostTypeCountSearch .create ();
441+ sc .setParameters ("type" , type );
442+ return getCount (sc );
443+ }
444+
432445 @ Override
433446 public List <HostVO > listByDataCenterId (long id ) {
434447 SearchCriteria <HostVO > sc = DcSearch .create ();
0 commit comments