[
https://issues.apache.org/jira/browse/CLOUDSTACK-8825?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14984319#comment-14984319
]
ASF GitHub Bot commented on CLOUDSTACK-8825:
--------------------------------------------
Github user DaanHoogland commented on a diff in the pull request:
https://github.com/apache/cloudstack/pull/787#discussion_r43580727
--- Diff: engine/schema/src/com/cloud/capacity/dao/CapacityDaoImpl.java ---
@@ -98,9 +98,9 @@
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 "
--- End diff --
the naming of these constants is not really in line with their purpose this
way. how about splitting it further and changing the names to
ORDER_HOSTS_BY_FREE_CAPACITY_SELECT_CLAUSE ,
ORDER_HOSTS_BY_FREE_CAPACITY_WHERE_CLAUSE ,
...
ORDER_HOSTS_BY_FREE_CAPACITY_ORDER_BY_CLAUSE ,
also the conditional part can be defined here
ORDER_HOSTS_BY_FREE_CAPACITY_CLUSTER_SELECTION = "AND cluster_id = ?";
> Setting vm.allocation.algorithm to firstfitleastconsumed makes vm migration
> impossible from UI
> ----------------------------------------------------------------------------------------------
>
> Key: CLOUDSTACK-8825
> URL: https://issues.apache.org/jira/browse/CLOUDSTACK-8825
> Project: CloudStack
> Issue Type: Bug
> Security Level: Public(Anyone can view this level - this is the
> default.)
> Reporter: Anshul Gangwar
> Assignee: Anshul Gangwar
> Priority: Critical
> Fix For: 4.6.0
>
>
> 2015-07-28 15:11:05,690 DEBUG [c.c.a.ApiServlet]
> (catalina-exec-20:ctx-1ba307fb) (logid:c70d7c41) ===START=== 10.103.2.50 --
> GET
> command=findHostsForMigration&VirtualMachineId=880e71e6-c714-4a65-adc4-dd1e08aae8dd&response=json&sessionkey=XF0%2Fsb%2BhBReDbbWgKx%2FMmujS0R8%3D&_=1438076504170
>
> 2015-07-28 15:11:05,751 ERROR [c.c.a.ApiServer]
> (catalina-exec-20:ctx-1ba307fb ctx-899f7829) (logid:c70d7c41) unhandled
> exception executing api command: [Ljava.lang.String;@39d29ca6
> com.cloud.utils.exception.CloudRuntimeException: Caught: 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
> at
> com.cloud.capacity.dao.CapacityDaoImpl.orderHostsByFreeCapacity(CapacityDaoImpl.java:884)
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)