Skip to content

Commit c378e9d

Browse files
Allow list async jobs by resource type alone
1 parent 7e43a3e commit c378e9d

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
@@ -3196,13 +3196,11 @@ private Pair<List<AsyncJobJoinVO>, Integer> searchForAsyncJobsInternal(ListAsync
31963196
sc.addAnd("instanceType", SearchCriteria.Op.EQ, resourceType.toString());
31973197

31983198
final String resourceId = getResourceUuid(cmd.getResourceId());
3199-
if (resourceId == null) {
3200-
throw new InvalidParameterValueException("Invalid resource id for the resource type " + resourceType);
3199+
if (resourceId != null) {
3200+
sc.addAnd("instanceUuid", SearchCriteria.Op.EQ, resourceId);
32013201
}
3202-
3203-
sc.addAnd("instanceUuid", SearchCriteria.Op.EQ, resourceId);
32043202
} else if (cmd.getResourceId() != null) {
3205-
throw new InvalidParameterValueException("Resource type must be specified for the resource id");
3203+
throw new InvalidParameterValueException(String.format("%s parameter must be used with %s parameter", ApiConstants.RESOURCE_ID, ApiConstants.RESOURCE_TYPE));
32063204
}
32073205

32083206
return _jobJoinDao.searchAndCount(sc, searchFilter);

0 commit comments

Comments
 (0)