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/b20e29cf
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/b20e29cf
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/b20e29cf

Branch: refs/heads/4.1
Commit: b20e29cffcafb4cb781b360a55203e4ef3dee968
Parents: 641594a
Author: Ryan Dietrich <[email protected]>
Authored: Fri Apr 12 14:00:41 2013 +0100
Committer: Chip Childers <[email protected]>
Committed: Fri Apr 12 14:02:24 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/b20e29cf/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 8d8663a..b96691a 100644
--- a/server/src/com/cloud/api/query/QueryManagerImpl.java
+++ b/server/src/com/cloud/api/query/QueryManagerImpl.java
@@ -2102,7 +2102,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 ){

Reply via email to