@@ -640,12 +640,12 @@ protected int validateAndGetDefaultBackupRetentionIfRequired(Integer maxBackups,
640640
641641 public List <BackupSchedule > listBackupSchedules (ListBackupScheduleCmd cmd ) {
642642 Account caller = CallContext .current ().getCallingAccount ();
643- boolean isRootAdmin = accountManager .isRootAdmin (caller .getId ());
644643 Long id = cmd .getId ();
645644 Long vmId = cmd .getVmId ();
646645 List <Long > permittedAccounts = new ArrayList <>();
647646 Long domainId = null ;
648647 Boolean isRecursive = null ;
648+ String keyword = cmd .getKeyword ();
649649 Project .ListProjectResourcesCriteria listProjectResourcesCriteria = null ;
650650
651651 if (vmId != null ) {
@@ -670,6 +670,11 @@ public List<BackupSchedule> listBackupSchedules(ListBackupScheduleCmd cmd) {
670670 if (vmId != null ) {
671671 searchBuilder .and ("vmId" , searchBuilder .entity ().getVmId (), SearchCriteria .Op .EQ );
672672 }
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+ }
673678
674679 SearchCriteria <BackupScheduleVO > sc = searchBuilder .create ();
675680 accountManager .buildACLSearchCriteria (sc , domainId , isRecursive , permittedAccounts , listProjectResourcesCriteria );
@@ -680,6 +685,9 @@ public List<BackupSchedule> listBackupSchedules(ListBackupScheduleCmd cmd) {
680685 if (vmId != null ) {
681686 sc .setParameters ("vmId" , vmId );
682687 }
688+ if (keyword != null && !keyword .isEmpty ()) {
689+ sc .setJoinParameters ("vmJoin" , "hostName" , "%" + keyword + "%" );
690+ }
683691
684692 Pair <List <BackupScheduleVO >, Integer > result = backupScheduleDao .searchAndCount (sc , searchFilter );
685693 return new ArrayList <>(result .first ());
0 commit comments