Only download eligible system template for S3 image store.

This commit is contained in:
Min Chen 2013-05-14 14:45:35 -07:00
parent 12583bbffc
commit 87af4ddab0

View File

@ -185,7 +185,22 @@ public class TemplateServiceImpl implements TemplateService {
toBeDownloaded.add(rtngTmplt);
}
List<HypervisorType> availHypers = _clusterDao.getAvailableHypervisorInZone(store.getScope().getScopeId());
if (availHypers.isEmpty()) {
/*
* This is for cloudzone, local secondary storage resource
* started before cluster created
*/
availHypers.add(HypervisorType.KVM);
}
/* Baremetal need not to download any template */
availHypers.remove(HypervisorType.BareMetal);
availHypers.add(HypervisorType.None); // bug 9809: resume ISO
// download.
for (VMTemplateVO template : toBeDownloaded) {
if (availHypers.contains(template.getHypervisorType())) {
// only download sys template applicable for current hypervisor
TemplateDataStoreVO tmpltHost = _vmTemplateStoreDao.findByStoreTemplate(store.getId(), template.getId());
if (tmpltHost == null || tmpltHost.getState() != ObjectInDataStoreStateMachine.State.Ready) {
TemplateInfo tmplt = _templateFactory.getTemplate(template.getId(), DataStoreRole.Image);
@ -193,6 +208,7 @@ public class TemplateServiceImpl implements TemplateService {
}
}
}
}
@Override
public void handleSysTemplateDownload(HypervisorType hostHyper, Long dcId) {