vishesh92 commented on code in PR #7949:
URL: https://github.com/apache/cloudstack/pull/7949#discussion_r1370674657
##########
server/src/main/java/com/cloud/api/query/QueryManagerImpl.java:
##########
@@ -4690,11 +4645,28 @@ private Pair<List<SnapshotJoinVO>, Integer>
searchForSnapshotsWithParams(final L
sb.join("tagSearch", tagSearch, sb.entity().getId(),
tagSearch.entity().getResourceId(), JoinBuilder.JoinType.INNER);
}
+ if (storagePoolId != null) {
+ SearchBuilder<SnapshotDataStoreVO> storagePoolSb =
snapshotDataStoreDao.createSearchBuilder();
+ storagePoolSb.and("poolId",
storagePoolSb.entity().getDataStoreId(), SearchCriteria.Op.EQ);
+ storagePoolSb.and("role", storagePoolSb.entity().getRole(),
SearchCriteria.Op.EQ);
+ sb.join("storagePoolSb", storagePoolSb, sb.entity().getId(),
storagePoolSb.entity().getSnapshotId(), JoinBuilder.JoinType.INNER);
+ }
Review Comment:
It won't behave as expected, if the user passes in both imagestore and
storagepool. I am expecting that output will contain snapshots as per the
filter on both image store and storage pool.
That is why for `imagestoreId`, I am querying within the view and joining
with storagepool for `storagepoolId`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]