mirror of https://github.com/apache/cloudstack.git
CLOUDSTACK-3513: ListIsos/ListTemplates does not return correct results
when id and zoneid are passed.
This commit is contained in:
parent
a2ba2358d8
commit
2bbf63bc7a
|
|
@ -2875,17 +2875,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
|
||||
|
|
@ -2893,6 +2882,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…
Reference in New Issue