cloudstack-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sudhansu7 <...@git.apache.org>
Subject [GitHub] cloudstack pull request: CLOUDSTACK-9366: Capacity of one zone-wid...
Date Sun, 24 Apr 2016 13:09:05 GMT
Github user sudhansu7 commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/1516#discussion_r60844257
  
    --- Diff: engine/schema/src/com/cloud/capacity/dao/CapacityDaoImpl.java ---
    @@ -962,35 +962,58 @@ public boolean removeBy(Short capacityType, Long zoneId, Long podId,
Long cluste
         }
     
         @Override
    -    public void updateCapacityState(Long dcId, Long podId, Long clusterId, Long hostId,
String capacityState) {
    +    public void updateCapacityState(Long dcId, Long podId, Long clusterId, Long hostId,
String capacityState, short[] capacityType) {
             TransactionLegacy txn = TransactionLegacy.currentTxn();
             StringBuilder sql = new StringBuilder(UPDATE_CAPACITY_STATE);
             List<Long> resourceIdList = new ArrayList<Long>();
    +        StringBuilder where = new StringBuilder();
     
             if (dcId != null) {
    -            sql.append(" data_center_id = ?");
    +            where.append(" data_center_id = ? ");
                 resourceIdList.add(dcId);
             }
             if (podId != null) {
    -            sql.append(" pod_id = ?");
    +            where.append((where.length() > 0) ? " and pod_id = ? " : " pod_id = ?
");
                 resourceIdList.add(podId);
             }
             if (clusterId != null) {
    -            sql.append(" cluster_id = ?");
    +            where.append((where.length() > 0) ? " and cluster_id = ? " : " cluster_id
= ? ");
                 resourceIdList.add(clusterId);
             }
             if (hostId != null) {
    -            sql.append(" host_id = ?");
    +            where.append((where.length() > 0) ? " and host_id = ? " : " host_id =
? ");
                 resourceIdList.add(hostId);
             }
     
    +        if (capacityType != null) {
    +            where.append((where.length() > 0) ? " and capacity_type in " : " capacity_type
in ");
    +
    +            StringBuilder builder = new StringBuilder();
    +            for( int i = 0 ; i < capacityType.length; i++ ) {
    +                if(i==0){
    +                    builder.append(" (? ");
    +                }else{
    +                    builder.append(" ,? ");
    +                }
    +            }
    +            builder.append(" ) ");
    --- End diff --
    
    Fixed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message