CLOUDSTACK-1989: Without this fix you can't query service offerings that don't have a domain id set (null).
Tested via: Called "listServiceOfferings" using a simple perl script, once with an ID, and once without an ID specified. Signed-off-by: Chip Childers <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/38df6286 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/38df6286 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/38df6286 Branch: refs/heads/cisco-vnmc-api-integration Commit: 38df62865d905aeac49fac7c32b66c7099036867 Parents: accfccd Author: Ryan Dietrich <[email protected]> Authored: Fri Apr 12 14:00:41 2013 +0100 Committer: Chip Childers <[email protected]> Committed: Fri Apr 12 14:03:28 2013 +0100 ---------------------------------------------------------------------- .../src/com/cloud/api/query/QueryManagerImpl.java | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/38df6286/server/src/com/cloud/api/query/QueryManagerImpl.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/api/query/QueryManagerImpl.java b/server/src/com/cloud/api/query/QueryManagerImpl.java index a498c18..ea58427 100644 --- a/server/src/com/cloud/api/query/QueryManagerImpl.java +++ b/server/src/com/cloud/api/query/QueryManagerImpl.java @@ -2119,7 +2119,11 @@ public class QueryManagerImpl extends ManagerBase implements QueryService { domainRecord = _domainDao.findById(domainRecord.getParent()); domainIds.add(domainRecord.getId()); } - sc.addAnd("domainId", SearchCriteria.Op.IN, domainIds.toArray()); + SearchCriteria<ServiceOfferingJoinVO> spc = _srvOfferingJoinDao.createSearchCriteria(); + + spc.addOr("domainId", SearchCriteria.Op.IN, domainIds.toArray()); + spc.addOr("domainId", SearchCriteria.Op.NULL); + sc.addAnd("domainId", SearchCriteria.Op.SC, spc); // include also public offering if no keyword, name and id specified if ( keyword == null && name == null && id == null ){
