rhtyd commented on a change in pull request #3248: [WIP DO NOT MERGE] server:
offerings for specified domain(s) and zone(s)
URL: https://github.com/apache/cloudstack/pull/3248#discussion_r288926311
##########
File path: server/src/main/java/com/cloud/api/query/QueryManagerImpl.java
##########
@@ -2782,11 +2808,50 @@
sc.addAnd("vmType", SearchCriteria.Op.EQ, vmTypeStr);
}
+ if (zoneId != null) {
+ SearchBuilder<ServiceOfferingJoinVO> sb =
_srvOfferingJoinDao.createSearchBuilder();
+ sb.and("zoneId", sb.entity().getZoneId(), Op.FIND_IN_SET);
+ sb.or("zId", sb.entity().getZoneId(), Op.NULL);
+ sb.done();
+ SearchCriteria<ServiceOfferingJoinVO> zoneSC = sb.create();
+ zoneSC.setParameters("zoneId", String.valueOf(zoneId));
+ sc.addAnd("zoneId", SearchCriteria.Op.SC, zoneSC);
+ }
+
Pair<List<ServiceOfferingJoinVO>, Integer> result =
_srvOfferingJoinDao.searchAndCount(sc, searchFilter);
//Couldn't figure out a smart way to filter offerings based on tags in
sql so doing it in Java.
List<ServiceOfferingJoinVO> filteredOfferings =
filterOfferingsOnCurrentTags(result.first(), currentVmOffering);
- return new Pair<>(filteredOfferings, result.second());
+ // Remove offerings that are not associated with caller's domain
+ // TODO: Better approach
Review comment:
@shwstppr implement the better approach?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services