fix the race condition for download template

This commit is contained in:
Edison Su 2011-06-03 13:19:48 -04:00
parent dbb1ed3645
commit 94b3890542
1 changed files with 4 additions and 0 deletions

View File

@ -659,6 +659,10 @@ public class DownloadMonitorImpl implements DownloadMonitor {
if (toBeDownloaded.size() > 0) {
/*Only download templates whose hypervirsor type is in the zone*/
List<HypervisorType> availHypers = _clusterDao.getAvailableHypervisorInZone(ssHost.getDataCenterId());
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.