JoaoJandre commented on code in PR #9546:
URL: https://github.com/apache/cloudstack/pull/9546#discussion_r1723709888


##########
server/src/main/java/com/cloud/api/query/QueryManagerImpl.java:
##########
@@ -3913,8 +3915,7 @@ private Pair<List<Long>, Integer> 
searchForServiceOfferingIdsAndCount(ListServic
             }
 
             serviceOfferingSearch.join("diskOfferingSearch", 
diskOfferingSearch, JoinBuilder.JoinType.INNER, JoinBuilder.JoinCondition.AND,
-                    serviceOfferingSearch.entity().getDiskOfferingId(), 
diskOfferingSearch.entity().getId(),
-                    serviceOfferingSearch.entity().setString("Active"), 
diskOfferingSearch.entity().getState());
+                    serviceOfferingSearch.entity().getDiskOfferingId(), 
diskOfferingSearch.entity().getId());

Review Comment:
   Isn't this a query that is executed if vmid != null? if so, should we list 
inactive offerings?



##########
engine/schema/src/main/java/com/cloud/vm/dao/VMInstanceDaoImpl.java:
##########
@@ -325,6 +326,10 @@ protected void init() {
         VmsNotInClusterUsingPool.join("hostSearch2", hostSearch2, 
hostSearch2.entity().getId(), VmsNotInClusterUsingPool.entity().getHostId(), 
JoinType.INNER);
         VmsNotInClusterUsingPool.and("vmStates", 
VmsNotInClusterUsingPool.entity().getState(), Op.IN);
         VmsNotInClusterUsingPool.done();
+
+        ServiceOfferingSearch = createSearchBuilder();
+        ServiceOfferingSearch.and("serviceOfferingId", 
ServiceOfferingSearch.entity().getServiceOfferingId(), Op.EQ);
+        BackupSearch.done();

Review Comment:
   Shouldn't it be ServiceOfferingSearch.done here?



##########
server/src/main/java/com/cloud/api/query/QueryManagerImpl.java:
##########
@@ -4043,6 +4044,8 @@ private Pair<List<Long>, Integer> 
searchForServiceOfferingIdsAndCount(ListServic
         SearchCriteria<ServiceOfferingVO> sc = serviceOfferingSearch.create();
         if (state != null) {
             sc.setParameters("state", state);
+        } else {
+            sc.setParameters("state", 
Arrays.asList(ServiceOffering.State.Active, ServiceOffering.State.Inactive));

Review Comment:
   Same here, if you do not set this parameter, both active and inactive 
offerings will be queried.



##########
server/src/main/java/com/cloud/api/query/QueryManagerImpl.java:
##########
@@ -3547,6 +3547,8 @@ private Ternary<List<Long>, Integer, String[]> 
searchForDiskOfferingsIdsAndCount
 
         if (state != null) {
             sc.setParameters("state", state);
+        } else {
+            sc.setParameters("state", 
Arrays.asList(ServiceOffering.State.Active, ServiceOffering.State.Inactive));

Review Comment:
   If you do not set the state condition (AKA `where state in x`), both active 
and inactive will be listed.



-- 
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]

Reply via email to