You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by re...@apache.org on 2015/11/02 12:09:03 UTC

[1/2] git commit: updated refs/heads/master to a981d34

Repository: cloudstack
Updated Branches:
  refs/heads/master e3a4ec6cf -> a981d34f4


CLOUDSTACK-8825, CLOUDSTACK-8824 : Fixed following issues if vm.allocation.algorithm is set to firstfitleastconsumed
1. VM deployment failure if thre is only ZWPS in setup
2. VM migration is impossible from UI


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/a5555ed2
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/a5555ed2
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/a5555ed2

Branch: refs/heads/master
Commit: a5555ed229de466a0b3834cc8983551cf36fcc53
Parents: 3079253
Author: Anshul Gangwar <an...@citrix.com>
Authored: Tue Sep 8 17:08:59 2015 +0530
Committer: Anshul Gangwar <an...@citrix.com>
Committed: Tue Sep 8 17:09:36 2015 +0530

----------------------------------------------------------------------
 .../com/cloud/capacity/dao/CapacityDaoImpl.java | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a5555ed2/engine/schema/src/com/cloud/capacity/dao/CapacityDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/capacity/dao/CapacityDaoImpl.java b/engine/schema/src/com/cloud/capacity/dao/CapacityDaoImpl.java
index 2bd6bcc..cdb69ce 100644
--- a/engine/schema/src/com/cloud/capacity/dao/CapacityDaoImpl.java
+++ b/engine/schema/src/com/cloud/capacity/dao/CapacityDaoImpl.java
@@ -98,9 +98,9 @@ public class CapacityDaoImpl extends GenericDaoBase<CapacityVO, Long> implements
 
     private static final String ORDER_PODS_BY_AGGREGATE_OVERCOMMIT_CAPACITY =
             "SELECT capacity.pod_id, SUM(used_capacity+reserved_capacity)/SUM(total_capacity * cluster_details.value) FROM `cloud`.`op_host_capacity` capacity INNER JOIN `cloud`.`cluster_details` cluster_details ON (capacity.cluster_id = cluster_details.cluster_id) WHERE data_center_id=? AND capacity_type = ?  AND cluster_details.name = ? GROUP BY capacity.pod_id ORDER BY SUM(used_capacity+reserved_capacity)/SUM(total_capacity * cluster_details.value) ASC";
-    private static final String ORDER_HOSTS_BY_FREE_CAPACITY = "SELECT host_id, SUM(total_capacity - (used_capacity+reserved_capacity))/SUM(total_capacity) FROM `cloud`.`op_host_capacity` WHERE "
-                    + " cluster_id = ? AND capacity_type = ? GROUP BY host_id ORDER BY SUM(total_capacity - (used_capacity+reserved_capacity))/SUM(total_capacity) DESC ";
-
+    private static final String ORDER_HOSTS_BY_FREE_CAPACITY_PART1 = "SELECT host_id, SUM(total_capacity - (used_capacity+reserved_capacity))/SUM(total_capacity) FROM `cloud`.`op_host_capacity` WHERE "
+                    + "capacity_type = ? ";
+    private static final String ORDER_HOSTS_BY_FREE_CAPACITY_PART2 = " GROUP BY host_id ORDER BY SUM(total_capacity - (used_capacity+reserved_capacity))/SUM(total_capacity) DESC ";
     private static final String LIST_CAPACITY_BY_RESOURCE_STATE =
             "SELECT capacity.data_center_id, sum(capacity.used_capacity), sum(capacity.reserved_quantity), sum(capacity.total_capacity), capacity_capacity_type "
                     + "FROM `cloud`.`op_host_capacity` capacity INNER JOIN `cloud`.`data_center` dc ON (dc.id = capacity.data_center_id AND dc.removed is NULL)"
@@ -864,12 +864,18 @@ public class CapacityDaoImpl extends GenericDaoBase<CapacityVO, Long> implements
          TransactionLegacy txn = TransactionLegacy.currentTxn();
          PreparedStatement pstmt = null;
          List<Long> result = new ArrayList<Long>();
-         StringBuilder sql = new StringBuilder(ORDER_HOSTS_BY_FREE_CAPACITY);
-
+         StringBuilder sql = new StringBuilder(ORDER_HOSTS_BY_FREE_CAPACITY_PART1);
+        if(clusterId != null) {
+            sql.append("AND cluster_id = ?");
+        }
+        sql.append(ORDER_HOSTS_BY_FREE_CAPACITY_PART2);
          try {
              pstmt = txn.prepareAutoCloseStatement(sql.toString());
-             pstmt.setLong(1, clusterId);
-             pstmt.setShort(2, capacityTypeForOrdering);
+             pstmt.setShort(1, capacityTypeForOrdering);
+             if(clusterId != null) {
+                pstmt.setLong(2, clusterId);
+             }
+
              ResultSet rs = pstmt.executeQuery();
              while (rs.next()) {
                  result.add(rs.getLong(1));


[2/2] git commit: updated refs/heads/master to a981d34

Posted by re...@apache.org.
Merge pull request #787 from anshul1886/CLOUDSTACK-8824-8825

CLOUDSTACK-8825, CLOUDSTACK-8824 : Fixed issues if vm.allocation.algorithm is set to firstfitleastconsumedFixed following issues if vm.allocation.algorithm is set to firstfitleastconsumed

1. VM deployment failure if thre is only ZWPS in setup
2. VM migration is impossible from UI

To test

1. Create setup with ZWPS only
2. set vm.allocation.algorithm to firstfitleastconsumed in global settings
3. deploy virtual machine

observation: vm deployment will fail

After this fix it will pass

second scenario

1. Create Cloudstack Setup with two hosts (As it needs setup for migration)
2. Try migrating VM from UI

Observation: There will be error response in logs with nothing available in UI

After fix it will pass

Regarding BVT I am not sure whether there exists tests for firstfitleastconsumed vm allocation algorithm.

* pr/787:
  CLOUDSTACK-8825, CLOUDSTACK-8824 : Fixed following issues if vm.allocation.algorithm is set to firstfitleastconsumed 1. VM deployment failure if thre is only ZWPS in setup 2. VM migration is impossible from UI

Signed-off-by: Remi Bergsma <gi...@remi.nl>


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/a981d34f
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/a981d34f
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/a981d34f

Branch: refs/heads/master
Commit: a981d34f4950e150d755f6e36e926b5cf757ca30
Parents: e3a4ec6 a5555ed
Author: Remi Bergsma <gi...@remi.nl>
Authored: Mon Nov 2 12:04:33 2015 +0100
Committer: Remi Bergsma <gi...@remi.nl>
Committed: Mon Nov 2 12:04:34 2015 +0100

----------------------------------------------------------------------
 .../com/cloud/capacity/dao/CapacityDaoImpl.java | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)
----------------------------------------------------------------------