long dataCenterId = pool.longValue();
List<SecondaryStorageVmVO> ssVms = _secStorageVmDao.getSecStorageVmListInStates(SecondaryStorageVm.Role.templateProcessor, dataCenterId, State.Running, State.Migrating,
State.Starting, State.Stopped, State.Stopping );
int vmSize = (ssVms == null)? 0 : ssVms.size();
List<DataStore> ssStores = _dataStoreMgr.getImageStoresByScope(new ZoneScope(dataCenterId));
int storeSize = (ssStores == null)? 0 : ssStores.size();
if ( storeSize > vmSize ) {
s_logger.info("No secondary storage vms found in datacenter id=" + dataCenterId + ", starting a new one");
return new Pair<AfterScanAction, Object>(AfterScanAction.expand, SecondaryStorageVm.Role.templateProcessor);
}