@@ -87,7 +87,7 @@ public class VMInstanceDaoImpl extends GenericDaoBase<VMInstanceVO, Long> implem
8787 protected SearchBuilder <VMInstanceVO > HostNameAndZoneSearch ;
8888 protected GenericSearchBuilder <VMInstanceVO , Long > FindIdsOfVirtualRoutersByAccount ;
8989 protected GenericSearchBuilder <VMInstanceVO , Long > CountActiveByHost ;
90- protected GenericSearchBuilder <VMInstanceVO , Long > CountRunningByAccount ;
90+ protected GenericSearchBuilder <VMInstanceVO , Long > CountRunningAndStartingByAccount ;
9191 protected GenericSearchBuilder <VMInstanceVO , Long > CountByZoneAndState ;
9292 protected SearchBuilder <VMInstanceVO > NetworkTypeSearch ;
9393 protected GenericSearchBuilder <VMInstanceVO , String > DistinctHostNameSearch ;
@@ -245,11 +245,11 @@ protected void init() {
245245 CountActiveByHost .and ("state" , CountActiveByHost .entity ().getState (), SearchCriteria .Op .IN );
246246 CountActiveByHost .done ();
247247
248- CountRunningByAccount = createSearchBuilder (Long .class );
249- CountRunningByAccount .select (null , Func .COUNT , null );
250- CountRunningByAccount .and ("account" , CountRunningByAccount .entity ().getAccountId (), SearchCriteria .Op .EQ );
251- CountRunningByAccount .and ("state " , CountRunningByAccount .entity ().getState (), SearchCriteria .Op .EQ );
252- CountRunningByAccount .done ();
248+ CountRunningAndStartingByAccount = createSearchBuilder (Long .class );
249+ CountRunningAndStartingByAccount .select (null , Func .COUNT , null );
250+ CountRunningAndStartingByAccount .and ("account" , CountRunningAndStartingByAccount .entity ().getAccountId (), SearchCriteria .Op .EQ );
251+ CountRunningAndStartingByAccount .and ("states " , CountRunningAndStartingByAccount .entity ().getState (), SearchCriteria .Op .IN );
252+ CountRunningAndStartingByAccount .done ();
253253
254254 CountByZoneAndState = createSearchBuilder (Long .class );
255255 CountByZoneAndState .select (null , Func .COUNT , null );
@@ -749,10 +749,10 @@ public HashMap<String, Long> countVgpuVMs(Long dcId, Long podId, Long clusterId)
749749 }
750750
751751 @ Override
752- public Long countRunningByAccount (long accountId ) {
753- SearchCriteria <Long > sc = CountRunningByAccount .create ();
752+ public Long countRunningAndStartingByAccount (long accountId ) {
753+ SearchCriteria <Long > sc = CountRunningAndStartingByAccount .create ();
754754 sc .setParameters ("account" , accountId );
755- sc .setParameters ("state " , State .Running );
755+ sc .setParameters ("states " , new Object [] { State .Starting , State . Running } );
756756 return customSearch (sc , null ).get (0 );
757757 }
758758
0 commit comments