mirror of
				https://github.com/apache/cloudstack.git
				synced 2025-11-04 00:02:37 +01:00 
			
		
		
		
	bug 11924: don't return ISO entries where removed != null
status 11924: resolved fixed reviewed by: Will Chan Conflicts: server/src/com/cloud/storage/dao/VMTemplateDao.java server/src/com/cloud/storage/dao/VMTemplateDaoImpl.java
This commit is contained in:
		
							parent
							
								
									e331e1c80f
								
							
						
					
					
						commit
						9ae3dffee4
					
				@ -68,7 +68,7 @@ public interface VMTemplateDao extends GenericDao<VMTemplateVO, Long> {
 | 
			
		||||
	public List<VMTemplateVO> listAllInZone(long dataCenterId);	
 | 
			
		||||
	
 | 
			
		||||
    public List<VMTemplateVO> listByHypervisorType(List<HypervisorType> hyperTypes);
 | 
			
		||||
	public List<VMTemplateVO> publicIsoSearch(Boolean bootable);
 | 
			
		||||
	public List<VMTemplateVO> publicIsoSearch(Boolean bootable, boolean listRemoved);
 | 
			
		||||
    VMTemplateVO findSystemVMTemplate(long zoneId);
 | 
			
		||||
    VMTemplateVO findSystemVMTemplate(long zoneId, HypervisorType hType);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -136,7 +136,7 @@ public class VMTemplateDaoImpl extends GenericDaoBase<VMTemplateVO, Long> implem
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public List<VMTemplateVO> publicIsoSearch(Boolean bootable){
 | 
			
		||||
    public List<VMTemplateVO> publicIsoSearch(Boolean bootable, boolean listRemoved){
 | 
			
		||||
        SearchCriteria<VMTemplateVO> sc = PublicIsoSearch.create();
 | 
			
		||||
    	sc.setParameters("public", 1);
 | 
			
		||||
    	sc.setParameters("format", "ISO");
 | 
			
		||||
@ -145,6 +145,10 @@ public class VMTemplateDaoImpl extends GenericDaoBase<VMTemplateVO, Long> implem
 | 
			
		||||
    	    sc.setParameters("bootable", bootable);
 | 
			
		||||
    	}
 | 
			
		||||
    	
 | 
			
		||||
    	if (!listRemoved) {
 | 
			
		||||
    		sc.setParameters("removed", (Object)null);
 | 
			
		||||
    	}
 | 
			
		||||
    	
 | 
			
		||||
        return listBy(sc);
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
@ -256,6 +260,8 @@ public class VMTemplateDaoImpl extends GenericDaoBase<VMTemplateVO, Long> implem
 | 
			
		||||
		PublicIsoSearch.and("format", PublicIsoSearch.entity().getFormat(), SearchCriteria.Op.EQ);
 | 
			
		||||
		PublicIsoSearch.and("type", PublicIsoSearch.entity().getTemplateType(), SearchCriteria.Op.EQ);
 | 
			
		||||
		PublicIsoSearch.and("bootable", PublicIsoSearch.entity().isBootable(), SearchCriteria.Op.EQ);
 | 
			
		||||
		PublicIsoSearch.and("removed", PublicIsoSearch.entity().getRemoved(), SearchCriteria.Op.EQ);
 | 
			
		||||
 | 
			
		||||
		
 | 
			
		||||
		tmpltTypeHyperSearch = createSearchBuilder();
 | 
			
		||||
		tmpltTypeHyperSearch.and("templateType", tmpltTypeHyperSearch.entity().getTemplateType(), SearchCriteria.Op.EQ);
 | 
			
		||||
@ -575,7 +581,7 @@ public class VMTemplateDaoImpl extends GenericDaoBase<VMTemplateVO, Long> implem
 | 
			
		||||
           if(isIso && templateZonePairList.size() < (pageSize != null ? pageSize : 500) 
 | 
			
		||||
                   && templateFilter != TemplateFilter.community 
 | 
			
		||||
                   && !(templateFilter == TemplateFilter.self && !BaseCmd.isRootAdmin(caller.getType())) ){ //evaluates to true If root admin and filter=self
 | 
			
		||||
            	List<VMTemplateVO> publicIsos = publicIsoSearch(bootable);            	
 | 
			
		||||
            	List<VMTemplateVO> publicIsos = publicIsoSearch(bootable, false);            	
 | 
			
		||||
            	for( int i=0; i < publicIsos.size(); i++){
 | 
			
		||||
                    if (keyword != null && publicIsos.get(i).getName().contains(keyword)) {
 | 
			
		||||
                        templateZonePairList.add(new Pair<Long,Long>(publicIsos.get(i).getId(), null));
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user