@@ -640,12 +640,12 @@ protected int validateAndGetDefaultBackupRetentionIfRequired(Integer maxBackups,
640
640
641
641
public List <BackupSchedule > listBackupSchedules (ListBackupScheduleCmd cmd ) {
642
642
Account caller = CallContext .current ().getCallingAccount ();
643
- boolean isRootAdmin = accountManager .isRootAdmin (caller .getId ());
644
643
Long id = cmd .getId ();
645
644
Long vmId = cmd .getVmId ();
646
645
List <Long > permittedAccounts = new ArrayList <>();
647
646
Long domainId = null ;
648
647
Boolean isRecursive = null ;
648
+ String keyword = cmd .getKeyword ();
649
649
Project .ListProjectResourcesCriteria listProjectResourcesCriteria = null ;
650
650
651
651
if (vmId != null ) {
@@ -670,6 +670,11 @@ public List<BackupSchedule> listBackupSchedules(ListBackupScheduleCmd cmd) {
670
670
if (vmId != null ) {
671
671
searchBuilder .and ("vmId" , searchBuilder .entity ().getVmId (), SearchCriteria .Op .EQ );
672
672
}
673
+ if (keyword != null && !keyword .isEmpty ()) {
674
+ SearchBuilder <VMInstanceVO > vmSearch = vmInstanceDao .createSearchBuilder ();
675
+ vmSearch .and ("hostName" , vmSearch .entity ().getHostName (), SearchCriteria .Op .LIKE );
676
+ searchBuilder .join ("vmJoin" , vmSearch , searchBuilder .entity ().getVmId (), vmSearch .entity ().getId (), JoinBuilder .JoinType .INNER );
677
+ }
673
678
674
679
SearchCriteria <BackupScheduleVO > sc = searchBuilder .create ();
675
680
accountManager .buildACLSearchCriteria (sc , domainId , isRecursive , permittedAccounts , listProjectResourcesCriteria );
@@ -680,6 +685,9 @@ public List<BackupSchedule> listBackupSchedules(ListBackupScheduleCmd cmd) {
680
685
if (vmId != null ) {
681
686
sc .setParameters ("vmId" , vmId );
682
687
}
688
+ if (keyword != null && !keyword .isEmpty ()) {
689
+ sc .setJoinParameters ("vmJoin" , "hostName" , "%" + keyword + "%" );
690
+ }
683
691
684
692
Pair <List <BackupScheduleVO >, Integer > result = backupScheduleDao .searchAndCount (sc , searchFilter );
685
693
return new ArrayList <>(result .first ());
0 commit comments