@@ -244,6 +244,11 @@ public List<StoragePoolVO> listLocalStoragePoolByPath(long datacenterId, String
244244
245245 @ Override
246246 public List <StoragePoolVO > listBy (long datacenterId , Long podId , Long clusterId , ScopeType scope ) {
247+ return listBy (datacenterId , podId , clusterId , scope , null );
248+ }
249+
250+ @ Override
251+ public List <StoragePoolVO > listBy (long datacenterId , Long podId , Long clusterId , ScopeType scope , String keyword ) {
247252 SearchCriteria <StoragePoolVO > sc = null ;
248253 if (clusterId != null ) {
249254 sc = DcPodSearch .create ();
@@ -255,6 +260,9 @@ public List<StoragePoolVO> listBy(long datacenterId, Long podId, Long clusterId,
255260 sc .setParameters ("datacenterId" , datacenterId );
256261 sc .setParameters ("podId" , podId );
257262 sc .setParameters ("status" , Status .Up );
263+ if (keyword != null ) {
264+ sc .addAnd ("name" , Op .LIKE , "%" + keyword + "%" );
265+ }
258266 if (scope != null ) {
259267 sc .setParameters ("scope" , scope );
260268 }
@@ -444,9 +452,14 @@ public List<StoragePoolVO> findDisabledPoolsByScope(long dcId, Long podId, Long
444452
445453 @ Override
446454 public List <StoragePoolVO > findLocalStoragePoolsByTags (long dcId , long podId , Long clusterId , String [] tags , boolean validateTagRule ) {
455+ return findLocalStoragePoolsByTags (dcId , podId , clusterId , tags , validateTagRule , null );
456+ }
457+
458+ @ Override
459+ public List <StoragePoolVO > findLocalStoragePoolsByTags (long dcId , long podId , Long clusterId , String [] tags , boolean validateTagRule , String keyword ) {
447460 List <StoragePoolVO > storagePools = null ;
448461 if (tags == null || tags .length == 0 ) {
449- storagePools = listBy (dcId , podId , clusterId , ScopeType .HOST );
462+ storagePools = listBy (dcId , podId , clusterId , ScopeType .HOST , keyword );
450463
451464 if (validateTagRule ) {
452465 storagePools = getPoolsWithoutTagRule (storagePools );
@@ -583,11 +596,19 @@ public List<StoragePoolVO> listPoolsByCluster(long clusterId) {
583596
584597 @ Override
585598 public List <StoragePoolVO > findZoneWideStoragePoolsByHypervisor (long dataCenterId , HypervisorType hypervisorType ) {
599+ return findZoneWideStoragePoolsByHypervisor (dataCenterId , hypervisorType , null );
600+ }
601+
602+ @ Override
603+ public List <StoragePoolVO > findZoneWideStoragePoolsByHypervisor (long dataCenterId , HypervisorType hypervisorType , String keyword ) {
586604 QueryBuilder <StoragePoolVO > sc = QueryBuilder .create (StoragePoolVO .class );
587605 sc .and (sc .entity ().getDataCenterId (), Op .EQ , dataCenterId );
588606 sc .and (sc .entity ().getStatus (), Op .EQ , Status .Up );
589607 sc .and (sc .entity ().getScope (), Op .EQ , ScopeType .ZONE );
590608 sc .and (sc .entity ().getHypervisor (), Op .EQ , hypervisorType );
609+ if (keyword != null ) {
610+ sc .and (sc .entity ().getName (), Op .LIKE , "%" + keyword + "%" );
611+ }
591612 return sc .list ();
592613 }
593614
@@ -612,10 +633,13 @@ public Integer countAll() {
612633 }
613634
614635 @ Override
615- public List <StoragePoolVO > findPoolsInClusters (List <Long > clusterIds ) {
636+ public List <StoragePoolVO > findPoolsInClusters (List <Long > clusterIds , String keyword ) {
616637 SearchCriteria <StoragePoolVO > sc = ClustersSearch .create ();
617638 sc .setParameters ("clusterIds" , clusterIds .toArray ());
618639 sc .setParameters ("status" , StoragePoolStatus .Up );
640+ if (keyword != null ) {
641+ sc .addAnd ("name" , Op .LIKE , "%" + keyword + "%" );
642+ }
619643 return listBy (sc );
620644 }
621645
0 commit comments