|
23 | 23 | import com.cloud.storage.ScopeType; |
24 | 24 | import com.cloud.storage.Storage; |
25 | 25 | import com.cloud.storage.StoragePool; |
26 | | -import com.cloud.storage.StoragePoolStatus; |
27 | 26 | import com.cloud.storage.StorageStats; |
28 | 27 | import com.cloud.storage.VolumeApiServiceImpl; |
29 | 28 | import com.cloud.user.AccountManager; |
30 | | -import com.cloud.utils.Pair; |
31 | 29 | import com.cloud.utils.StringUtils; |
32 | | -import com.cloud.utils.db.Filter; |
33 | 30 | import com.cloud.utils.db.GenericDaoBase; |
34 | 31 | import com.cloud.utils.db.SearchBuilder; |
35 | 32 | import com.cloud.utils.db.SearchCriteria; |
@@ -311,79 +308,6 @@ public List<StoragePoolJoinVO> searchByIds(Long... spIds) { |
311 | 308 | return uvList; |
312 | 309 | } |
313 | 310 |
|
314 | | - @Override |
315 | | - public Pair<List<StoragePoolJoinVO>, Integer> searchAndCount(Long storagePoolId, String storagePoolName, |
316 | | - Long zoneId, String path, Long podId, Long clusterId, String address, ScopeType scopeType, |
317 | | - StoragePoolStatus status, String keyword, Filter searchFilter) { |
318 | | - SearchCriteria<StoragePoolJoinVO> sc = createStoragePoolSearchCriteria(storagePoolId, storagePoolName, zoneId, path, podId, clusterId, address, scopeType, status, keyword); |
319 | | - return searchAndCount(sc, searchFilter); |
320 | | - } |
321 | | - |
322 | | - private SearchCriteria<StoragePoolJoinVO> createStoragePoolSearchCriteria(Long storagePoolId, String storagePoolName, Long zoneId, String path, Long podId, Long clusterId, String address, ScopeType scopeType, StoragePoolStatus status, String keyword) { |
323 | | - SearchBuilder<StoragePoolJoinVO> sb = createSearchBuilder(); |
324 | | - sb.select(null, SearchCriteria.Func.DISTINCT, sb.entity().getId()); // select distinct |
325 | | - // ids |
326 | | - sb.and("id", sb.entity().getId(), SearchCriteria.Op.EQ); |
327 | | - sb.and("name", sb.entity().getName(), SearchCriteria.Op.EQ); |
328 | | - sb.and("path", sb.entity().getPath(), SearchCriteria.Op.EQ); |
329 | | - sb.and("dataCenterId", sb.entity().getZoneId(), SearchCriteria.Op.EQ); |
330 | | - sb.and("podId", sb.entity().getPodId(), SearchCriteria.Op.EQ); |
331 | | - sb.and("clusterId", sb.entity().getClusterId(), SearchCriteria.Op.EQ); |
332 | | - sb.and("hostAddress", sb.entity().getHostAddress(), SearchCriteria.Op.EQ); |
333 | | - sb.and("scope", sb.entity().getScope(), SearchCriteria.Op.EQ); |
334 | | - sb.and("status", sb.entity().getStatus(), SearchCriteria.Op.EQ); |
335 | | - sb.and("parent", sb.entity().getParent(), SearchCriteria.Op.EQ); |
336 | | - |
337 | | - SearchCriteria<StoragePoolJoinVO> sc = sb.create(); |
338 | | - |
339 | | - if (keyword != null) { |
340 | | - SearchCriteria<StoragePoolJoinVO> ssc = createSearchCriteria(); |
341 | | - ssc.addOr("name", SearchCriteria.Op.LIKE, "%" + keyword + "%"); |
342 | | - ssc.addOr("poolType", SearchCriteria.Op.LIKE, "%" + keyword + "%"); |
343 | | - |
344 | | - sc.addAnd("name", SearchCriteria.Op.SC, ssc); |
345 | | - } |
346 | | - |
347 | | - if (storagePoolId != null) { |
348 | | - sc.setParameters("id", storagePoolId); |
349 | | - } |
350 | | - |
351 | | - if (storagePoolName != null) { |
352 | | - sc.setParameters("name", storagePoolName); |
353 | | - } |
354 | | - |
355 | | - if (path != null) { |
356 | | - sc.setParameters("path", path); |
357 | | - } |
358 | | - if (zoneId != null) { |
359 | | - sc.setParameters("dataCenterId", zoneId); |
360 | | - } |
361 | | - if (podId != null) { |
362 | | - SearchCriteria<StoragePoolJoinVO> ssc = createSearchCriteria(); |
363 | | - ssc.addOr("podId", SearchCriteria.Op.EQ, podId); |
364 | | - ssc.addOr("podId", SearchCriteria.Op.NULL); |
365 | | - |
366 | | - sc.addAnd("podId", SearchCriteria.Op.SC, ssc); |
367 | | - } |
368 | | - if (address != null) { |
369 | | - sc.setParameters("hostAddress", address); |
370 | | - } |
371 | | - if (clusterId != null) { |
372 | | - SearchCriteria<StoragePoolJoinVO> ssc = createSearchCriteria(); |
373 | | - ssc.addOr("clusterId", SearchCriteria.Op.EQ, clusterId); |
374 | | - ssc.addOr("clusterId", SearchCriteria.Op.NULL); |
375 | | - |
376 | | - sc.addAnd("clusterId", SearchCriteria.Op.SC, ssc); |
377 | | - } |
378 | | - if (scopeType != null) { |
379 | | - sc.setParameters("scope", scopeType.toString()); |
380 | | - } |
381 | | - if (status != null) { |
382 | | - sc.setParameters("status", status.toString()); |
383 | | - } |
384 | | - sc.setParameters("parent", 0); |
385 | | - return sc; |
386 | | - } |
387 | 311 | @Override |
388 | 312 | public List<StoragePoolVO> findStoragePoolByScopeAndRuleTags(Long datacenterId, Long podId, Long clusterId, ScopeType scopeType, List<String> tags) { |
389 | 313 | SearchCriteria<StoragePoolJoinVO> sc = findByDatacenterAndScopeSb.create(); |
|
0 commit comments