mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
CLOUDSTACK-3513: ListIsos/ListTemplates does not return correct results
when id and zoneid are passed.
This commit is contained in:
parent
ad269304f6
commit
6689e83d7f
@ -2876,17 +2876,6 @@ public class QueryManagerImpl extends ManagerBase implements QueryService {
|
||||
sc.addAnd("state", SearchCriteria.Op.SC, readySc);
|
||||
}
|
||||
|
||||
if (zoneId != null) {
|
||||
SearchCriteria<TemplateJoinVO> zoneSc = _templateJoinDao.createSearchCriteria();
|
||||
zoneSc.addOr("dataCenterId", SearchCriteria.Op.EQ, zoneId);
|
||||
zoneSc.addOr("dataStoreScope", SearchCriteria.Op.EQ, ScopeType.REGION);
|
||||
// handle the case where xs-tools.iso and vmware-tools.iso do not have data_center information in template_view
|
||||
SearchCriteria<TemplateJoinVO> isoPerhostSc = _templateJoinDao.createSearchCriteria();
|
||||
isoPerhostSc.addAnd("format", SearchCriteria.Op.EQ, ImageFormat.ISO);
|
||||
isoPerhostSc.addAnd("templateType", SearchCriteria.Op.EQ, TemplateType.PERHOST);
|
||||
zoneSc.addOr("templateType", SearchCriteria.Op.SC, isoPerhostSc);
|
||||
sc.addAnd("dataCenterId", SearchCriteria.Op.SC, zoneSc);
|
||||
}
|
||||
|
||||
if (!showDomr) {
|
||||
// excluding system template
|
||||
@ -2894,6 +2883,19 @@ public class QueryManagerImpl extends ManagerBase implements QueryService {
|
||||
}
|
||||
}
|
||||
|
||||
if (zoneId != null) {
|
||||
SearchCriteria<TemplateJoinVO> zoneSc = _templateJoinDao.createSearchCriteria();
|
||||
zoneSc.addOr("dataCenterId", SearchCriteria.Op.EQ, zoneId);
|
||||
zoneSc.addOr("dataStoreScope", SearchCriteria.Op.EQ, ScopeType.REGION);
|
||||
// handle the case where xs-tools.iso and vmware-tools.iso do not
|
||||
// have data_center information in template_view
|
||||
SearchCriteria<TemplateJoinVO> isoPerhostSc = _templateJoinDao.createSearchCriteria();
|
||||
isoPerhostSc.addAnd("format", SearchCriteria.Op.EQ, ImageFormat.ISO);
|
||||
isoPerhostSc.addAnd("templateType", SearchCriteria.Op.EQ, TemplateType.PERHOST);
|
||||
zoneSc.addOr("templateType", SearchCriteria.Op.SC, isoPerhostSc);
|
||||
sc.addAnd("dataCenterId", SearchCriteria.Op.SC, zoneSc);
|
||||
}
|
||||
|
||||
// don't return removed template, this should not be needed since we
|
||||
// changed annotation for removed field in TemplateJoinVO.
|
||||
// sc.addAnd("removed", SearchCriteria.Op.NULL);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user