Skip to content

Commit 38abe2d

Browse files
Allow list async jobs by resource type alone (#13011)
1 parent feb6076 commit 38abe2d

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

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

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3197,13 +3197,11 @@ private Pair<List<AsyncJobJoinVO>, Integer> searchForAsyncJobsInternal(ListAsync
31973197
sc.addAnd("instanceType", SearchCriteria.Op.EQ, resourceType.toString());
31983198

31993199
final String resourceId = getResourceUuid(cmd.getResourceId());
3200-
if (resourceId == null) {
3201-
throw new InvalidParameterValueException("Invalid resource id for the resource type " + resourceType);
3200+
if (resourceId != null) {
3201+
sc.addAnd("instanceUuid", SearchCriteria.Op.EQ, resourceId);
32023202
}
3203-
3204-
sc.addAnd("instanceUuid", SearchCriteria.Op.EQ, resourceId);
32053203
} else if (cmd.getResourceId() != null) {
3206-
throw new InvalidParameterValueException("Resource type must be specified for the resource id");
3204+
throw new InvalidParameterValueException(String.format("%s parameter must be used with %s parameter", ApiConstants.RESOURCE_ID, ApiConstants.RESOURCE_TYPE));
32073205
}
32083206

32093207
return _jobJoinDao.searchAndCount(sc, searchFilter);

0 commit comments

Comments
 (0)