From 94b389054278e64ef05808eb1799cdd4a47e6372 Mon Sep 17 00:00:00 2001 From: Edison Su Date: Fri, 3 Jun 2011 13:19:48 -0400 Subject: [PATCH] fix the race condition for download template --- .../src/com/cloud/storage/download/DownloadMonitorImpl.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/server/src/com/cloud/storage/download/DownloadMonitorImpl.java b/server/src/com/cloud/storage/download/DownloadMonitorImpl.java index a492396ff1b..37d1c91a404 100755 --- a/server/src/com/cloud/storage/download/DownloadMonitorImpl.java +++ b/server/src/com/cloud/storage/download/DownloadMonitorImpl.java @@ -659,6 +659,10 @@ public class DownloadMonitorImpl implements DownloadMonitor { if (toBeDownloaded.size() > 0) { /*Only download templates whose hypervirsor type is in the zone*/ List 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.