Skip to content

Commit 5e5ae0c

Browse files
authored
Fix type parameter in listBackupServiceJobs API (#13940)
1 parent ba67a62 commit 5e5ae0c

3 files changed

Lines changed: 7 additions & 8 deletions

File tree

‎engine/schema/src/main/java/org/apache/cloudstack/backup/dao/InternalBackupServiceJobDao.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public interface InternalBackupServiceJobDao extends GenericDao<InternalBackupSe
3232

3333
List<InternalBackupServiceJobVO> listExecutingJobsByHostsAndStartTimeBeforeAndTypeIn(Object[] hostIds, Date date, InternalBackupServiceJobType... jobTypes);
3434

35-
Pair<List<InternalBackupServiceJobVO>, Integer> searchAndCountForListApi(Long id, Long backupId, Long hostId, Long zoneId, InternalBackupServiceJobType type, boolean executing,
35+
Pair<List<InternalBackupServiceJobVO>, Integer> searchAndCountForListApi(Long id, Long backupId, Long hostId, Long zoneId, String type, boolean executing,
3636
boolean scheduled, Long startIndex, Long pageSize);
3737

3838
void update(InternalBackupServiceJobVO job);

‎engine/schema/src/main/java/org/apache/cloudstack/backup/dao/InternalBackupServiceJobDaoImpl.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public List<InternalBackupServiceJobVO> listExecutingJobsByHostsAndStartTimeBefo
9898
}
9999

100100
@Override
101-
public Pair<List<InternalBackupServiceJobVO>, Integer> searchAndCountForListApi(Long id, Long backupId, Long hostId, Long zoneId, InternalBackupServiceJobType type, boolean executing,
101+
public Pair<List<InternalBackupServiceJobVO>, Integer> searchAndCountForListApi(Long id, Long backupId, Long hostId, Long zoneId, String type, boolean executing,
102102
boolean scheduled, Long startIndex, Long pageSize) {
103103
SearchBuilder<InternalBackupServiceJobVO> sb = createSearchBuilder();
104104

@@ -122,7 +122,7 @@ public Pair<List<InternalBackupServiceJobVO>, Integer> searchAndCountForListApi(
122122
sc.setParametersIfNotNull(HOST_ID, hostId);
123123
sc.setParametersIfNotNull(ZONE_ID, zoneId);
124124
if (type != null) {
125-
sc.setParameters(TYPE, type);
125+
sc.setParameters(TYPE, InternalBackupServiceJobType.valueOf(type));
126126
}
127127

128128
Filter filter = new Filter(InternalBackupServiceJobVO.class, "created", false, startIndex, pageSize);

‎server/src/main/java/com/cloud/api/query/QueryManagerImpl.java‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,6 @@
158158
import org.apache.cloudstack.api.response.VirtualMachineResponse;
159159
import org.apache.cloudstack.api.response.VolumeResponse;
160160
import org.apache.cloudstack.api.response.ZoneResponse;
161-
import org.apache.cloudstack.backup.InternalBackupServiceJobType;
162161
import org.apache.cloudstack.backup.InternalBackupServiceJobVO;
163162
import org.apache.cloudstack.backup.BackupOfferingVO;
164163
import org.apache.cloudstack.backup.BackupVO;
@@ -6436,7 +6435,7 @@ private List<BucketVO> searchForBucketsInternal(ListBucketsCmd cmd) {
64366435
public ListResponse<BackupServiceJobResponse> listBackupServiceJobs(ListBackupServiceJobsCmd cmd) {
64376436
ListResponse<BackupServiceJobResponse> responses = new ListResponse<>();
64386437
Pair<List<InternalBackupServiceJobVO>, Integer> result = listBackupServiceJobsInternal(cmd);
6439-
List<BackupServiceJobResponse> compressionJobResponses = new ArrayList<>();
6438+
List<BackupServiceJobResponse> backupServiceJobResponses = new ArrayList<>();
64406439

64416440
for (InternalBackupServiceJobVO jobVO : result.first()) {
64426441
BackupVO backup = backupDao.findByIdIncludingRemoved(jobVO.getBackupId());
@@ -6448,16 +6447,16 @@ public ListResponse<BackupServiceJobResponse> listBackupServiceJobs(ListBackupSe
64486447
if (jobVO.getHostId() != null) {
64496448
response.setHostId(hostDao.findByIdIncludingRemoved(jobVO.getHostId()).getUuid());
64506449
}
6451-
compressionJobResponses.add(response);
6450+
backupServiceJobResponses.add(response);
64526451
}
64536452

6454-
responses.setResponses(compressionJobResponses, result.second());
6453+
responses.setResponses(backupServiceJobResponses, result.second());
64556454
return responses;
64566455
}
64576456

64586457
private Pair<List<InternalBackupServiceJobVO>, Integer> listBackupServiceJobsInternal(ListBackupServiceJobsCmd cmd) {
64596458
return internalBackupServiceJobDao.searchAndCountForListApi(cmd.getId(), cmd.getBackupId(), cmd.getHostId(), cmd.getZoneId(),
6460-
InternalBackupServiceJobType.valueOf(cmd.getType()), cmd.getExecuting(), cmd.getScheduled(), cmd.getStartIndex(), cmd.getPageSizeVal());
6459+
cmd.getType(), cmd.getExecuting(), cmd.getScheduled(), cmd.getStartIndex(), cmd.getPageSizeVal());
64616460
}
64626461

64636462
@Override

0 commit comments

Comments
 (0)