Swift : list template in secondry storage as well

This commit is contained in:
anthony 2011-11-04 16:39:31 -07:00
parent 568b64a0e5
commit 92f4a88c68
1 changed files with 10 additions and 1 deletions

View File

@ -1396,13 +1396,22 @@ public class ManagementServerImpl implements ManagementServer {
if (template == null) {
templateZonePairSet = _templateDao.searchSwiftTemplates(name, keyword, templateFilter, isIso, hypers, bootable, domain, pageSize, startIndex, zoneId, hyperType, onlyReady, showDomr,
permittedAccounts, caller);
Set<Pair<Long, Long>> templateZonePairSet2 = new HashSet<Pair<Long, Long>>();
templateZonePairSet2 = _templateDao.searchTemplates(name, keyword, templateFilter, isIso, hypers, bootable, domain, pageSize, startIndex, zoneId, hyperType, onlyReady, showDomr,
permittedAccounts, caller);
for (Pair<Long, Long> tmpltPair : templateZonePairSet2) {
if (!templateZonePairSet.contains(new Pair<Long, Long>(tmpltPair.first(), 0L))) {
templateZonePairSet.add(tmpltPair);
}
}
} else {
// if template is not public, perform permission check here
if (!template.isPublicTemplate() && caller.getType() != Account.ACCOUNT_TYPE_ADMIN) {
Account owner = _accountMgr.getAccount(template.getAccountId());
_accountMgr.checkAccess(caller, null, owner);
}
templateZonePairSet.add(new Pair<Long, Long>(template.getId(), 0L));
templateZonePairSet.add(new Pair<Long, Long>(template.getId(), zoneId));
}
} else {
if (template == null) {