You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit ccec275
Browse filesBrowse the repository at this point in the historyBrowse files
Prachi Damle
committed
CLOUDSTACK-3904 listHosts API fails in VMware setup when virtualmachineid parameter is passed
Changes:
- Pod and Cluster can be null, modified the query to append these only if non-null
"SELECT host.cluster_id, SUM(IF(vm.state='Running' AND vm.account_id = ?, 1, 0)) FROM `cloud`.`host` host LEFT JOIN `cloud`.`vm_instance` vm ON host.id = vm.host_id WHERE ";
" AND host.type = 'Routing' GROUP BY host.cluster_id ORDER BY 2 ASC ";
98
+
" AND host.type = 'Routing' AND host.removed is null GROUP BY host.cluster_id ORDER BY 2 ASC ";
99
99
100
-
privatestaticfinalStringORDER_PODS_NUMBER_OF_VMS_FOR_ACCOUNT = "SELECT pod.id, SUM(IF(vm.state='Running' AND vm.account_id = ?, 1, 0)) FROM `cloud`.`host_pod_ref` pod LEFT JOIN `cloud`.`vm_instance` vm ON pod.id = vm.pod_id WHERE pod.data_center_id = ? " +
100
+
privatestaticfinalStringORDER_PODS_NUMBER_OF_VMS_FOR_ACCOUNT = "SELECT pod.id, SUM(IF(vm.state='Running' AND vm.account_id = ?, 1, 0)) FROM `cloud`.`host_pod_ref` pod LEFT JOIN `cloud`.`vm_instance` vm ON pod.id = vm.pod_id WHERE pod.data_center_id = ? AND pod.removed is null " +
"SELECT host.id, SUM(IF(vm.state='Running' AND vm.account_id = ?, 1, 0)) FROM `cloud`.`host` host LEFT JOIN `cloud`.`vm_instance` vm ON host.id = vm.host_id WHERE host.data_center_id = ? " +
105
-
" AND host.pod_id = ? AND host.cluster_id = ? AND host.type = 'Routing' " +
106
-
" GROUP BY host.id ORDER BY 2 ASC ";
103
+
privatestaticfinalStringORDER_HOSTS_NUMBER_OF_VMS_FOR_ACCOUNT ="SELECT host.id, SUM(IF(vm.state='Running' AND vm.account_id = ?, 1, 0)) FROM `cloud`.`host` host LEFT JOIN `cloud`.`vm_instance` vm ON host.id = vm.host_id WHERE host.data_center_id = ? "
104
+
+ " AND host.type = 'Routing' AND host.removed is null ";
105
+
106
+
privatestaticfinalStringORDER_HOSTS_NUMBER_OF_VMS_FOR_ACCOUNT_PART2 =" GROUP BY host.id ORDER BY 2 ASC ";
107
107
108
108
@InjectprotectedHostDao_hostDao;
109
109
@@ -561,11 +561,25 @@ public List<Long> listHostIdsByVmCount(long dcId, Long podId, Long clusterId, lo
0 commit comments