mirror of https://github.com/apache/cloudstack.git
CLOUDSTACK-3120: ListTemplates didn't return Baremetal templates after
storage refactor.
This commit is contained in:
parent
22232f2baf
commit
64c5266ec5
|
|
@ -133,6 +133,7 @@ import com.cloud.server.TaggedResourceService;
|
|||
import com.cloud.service.ServiceOfferingVO;
|
||||
import com.cloud.service.dao.ServiceOfferingDao;
|
||||
import com.cloud.storage.Storage.ImageFormat;
|
||||
import com.cloud.storage.Storage.TemplateType;
|
||||
import com.cloud.storage.dao.VMTemplateDao;
|
||||
import com.cloud.storage.dao.VolumeDetailsDao;
|
||||
import com.cloud.template.VirtualMachineTemplate.TemplateFilter;
|
||||
|
|
@ -2834,7 +2835,14 @@ public class QueryManagerImpl extends ManagerBase implements QueryService {
|
|||
}
|
||||
|
||||
if (onlyReady) {
|
||||
sc.addAnd("state", SearchCriteria.Op.EQ, TemplateState.Ready);
|
||||
SearchCriteria<TemplateJoinVO> readySc = _templateJoinDao.createSearchCriteria();
|
||||
readySc.addOr("state", SearchCriteria.Op.EQ, TemplateState.Ready);
|
||||
readySc.addOr("format", SearchCriteria.Op.EQ, ImageFormat.BAREMETAL);
|
||||
SearchCriteria<TemplateJoinVO> isoPerhostSc = _templateJoinDao.createSearchCriteria();
|
||||
isoPerhostSc.addAnd("format", SearchCriteria.Op.EQ, ImageFormat.ISO);
|
||||
isoPerhostSc.addAnd("templateType", SearchCriteria.Op.EQ, TemplateType.PERHOST);
|
||||
readySc.addOr("templateType", SearchCriteria.Op.SC, isoPerhostSc);
|
||||
sc.addAnd("state", SearchCriteria.Op.SC, readySc);
|
||||
}
|
||||
|
||||
if (zoneId != null) {
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ import com.cloud.api.ApiResponseHelper;
|
|||
import com.cloud.api.query.vo.ResourceTagJoinVO;
|
||||
import com.cloud.api.query.vo.TemplateJoinVO;
|
||||
import com.cloud.configuration.dao.ConfigurationDao;
|
||||
import com.cloud.storage.Storage;
|
||||
import com.cloud.storage.VMTemplateHostVO;
|
||||
import com.cloud.storage.Storage.TemplateType;
|
||||
import com.cloud.storage.VMTemplateStorageResourceAssoc.Status;
|
||||
|
|
@ -104,7 +105,13 @@ public class TemplateJoinDaoImpl extends GenericDaoBase<TemplateJoinVO, Long> im
|
|||
templateResponse.setDisplayText(template.getDisplayText());
|
||||
templateResponse.setPublic(template.isPublicTemplate());
|
||||
templateResponse.setCreated(template.getCreatedOnStore());
|
||||
templateResponse.setReady(template.getState() == ObjectInDataStoreStateMachine.State.Ready);
|
||||
if ( template.getFormat() == Storage.ImageFormat.BAREMETAL ){
|
||||
// for baremetal template, we didn't download, but is ready to use.
|
||||
templateResponse.setReady(true);
|
||||
}
|
||||
else{
|
||||
templateResponse.setReady(template.getState() == ObjectInDataStoreStateMachine.State.Ready);
|
||||
}
|
||||
templateResponse.setFeatured(template.isFeatured());
|
||||
templateResponse.setExtractable(template.isExtractable() && !(template.getTemplateType() == TemplateType.SYSTEM));
|
||||
templateResponse.setPasswordEnabled(template.isEnablePassword());
|
||||
|
|
|
|||
Loading…
Reference in New Issue