mirror of
https://github.com/apache/cloudstack.git
synced 2025-12-16 18:43:26 +01:00
CLOUDSTACK-2120: API - mixed zone management - fix a bug that listTemplates/listIsos API didn't take in zoneType properly.
This commit is contained in:
parent
50a3c918c8
commit
3d10f700f9
@ -562,10 +562,15 @@ public class VMTemplateDaoImpl extends GenericDaoBase<VMTemplateVO, Long> implem
|
|||||||
sql = SELECT_TEMPLATE_HOST_REF;
|
sql = SELECT_TEMPLATE_HOST_REF;
|
||||||
groupByClause = " GROUP BY t.id, h.data_center_id ";
|
groupByClause = " GROUP BY t.id, h.data_center_id ";
|
||||||
}
|
}
|
||||||
if (((templateFilter == TemplateFilter.featured) || (templateFilter == TemplateFilter.community)) ||(zoneType != null && zoneId != null)) {
|
if ((templateFilter == TemplateFilter.featured) || (templateFilter == TemplateFilter.community)) {
|
||||||
dataCenterJoin = " INNER JOIN data_center dc on (h.data_center_id = dc.id)";
|
dataCenterJoin = " INNER JOIN data_center dc on (h.data_center_id = dc.id)";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (zoneType != null) {
|
||||||
|
dataCenterJoin = " INNER JOIN template_host_ref thr on (t.id = thr.template_id) INNER JOIN host h on (thr.host_id = h.id)";
|
||||||
|
dataCenterJoin += " INNER JOIN data_center dc on (h.data_center_id = dc.id)";
|
||||||
|
}
|
||||||
|
|
||||||
if (templateFilter == TemplateFilter.sharedexecutable || templateFilter == TemplateFilter.shared ){
|
if (templateFilter == TemplateFilter.sharedexecutable || templateFilter == TemplateFilter.shared ){
|
||||||
lpjoin = " INNER JOIN launch_permission lp ON t.id = lp.template_id ";
|
lpjoin = " INNER JOIN launch_permission lp ON t.id = lp.template_id ";
|
||||||
}
|
}
|
||||||
@ -783,13 +788,15 @@ public class VMTemplateDaoImpl extends GenericDaoBase<VMTemplateVO, Long> implem
|
|||||||
sql += " AND h.data_center_id = " +zoneId;
|
sql += " AND h.data_center_id = " +zoneId;
|
||||||
}
|
}
|
||||||
}else if (zoneId != null){
|
}else if (zoneId != null){
|
||||||
sql += " AND tzr.zone_id = " +zoneId+ " AND tzr.removed is null" ;
|
sql += " AND tzr.zone_id = " +zoneId+ " AND tzr.removed is null" ;
|
||||||
if (zoneType != null){
|
|
||||||
sql += " AND dc.networktype = " + zoneType;
|
|
||||||
}
|
|
||||||
}else{
|
}else{
|
||||||
sql += " AND tzr.removed is null ";
|
sql += " AND tzr.removed is null ";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (zoneType != null){
|
||||||
|
sql += " AND dc.networktype = '" + zoneType + "'";
|
||||||
|
}
|
||||||
|
|
||||||
if (!showDomr){
|
if (!showDomr){
|
||||||
sql += " AND t.type != '" +Storage.TemplateType.SYSTEM.toString() + "'";
|
sql += " AND t.type != '" +Storage.TemplateType.SYSTEM.toString() + "'";
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user