[GitHub] cloudstack pull request: CLOUDSTACK-8841: Storage XenMotion from X...

2016-04-24 Thread priyankparihar
Github user priyankparihar commented on the pull request:

https://github.com/apache/cloudstack/pull/815#issuecomment-214146326
  
@koushik-das 
Currently UI does not allow migration between different versions, and 
changing UI for this change is not elegant. Purpose of doing this change is if 
some user **intentionally** want to do migration from lower to higher then he 
can do it via API(from UI he can not do this). Other way around Hypervisor will 
not allow him.

@agneya2001 @sateesh-chodapuneedi @koushik-das 
Your point looks good, but  How ordering could be defined ?



---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request: CLOUDSTACK-9366: Capacity of one zone-wid...

2016-04-24 Thread SudharmaJain
Github user SudharmaJain commented on the pull request:

https://github.com/apache/cloudstack/pull/1516#issuecomment-214143155
  
LGTM. Code Reviewed. 


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request: CLOUDSTACK-9366: Capacity of one zone-wid...

2016-04-24 Thread alexandrelimassantana
Github user alexandrelimassantana commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/1516#discussion_r60852850
  
--- Diff: engine/schema/src/com/cloud/capacity/dao/CapacityDaoImpl.java ---
@@ -962,35 +962,59 @@ 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 resourceIdList = new ArrayList();
+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 && capacityType.length > 0) {
+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(" (? ");
--- End diff --

You can extract the if(i==0) code from the for and write it before the 
loop. That way you don`t need to check anything inside the loop


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request: CLOUDSTACK-9366: Capacity of one zone-wid...

2016-04-24 Thread sudhansu7
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 resourceIdList = new ArrayList();
+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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---