From 56535a7a83f9871f97023e84f87bc9d65aa0f868 Mon Sep 17 00:00:00 2001 From: Anthony Xu Date: Wed, 29 May 2013 15:18:20 -0700 Subject: [PATCH] zero size of template/volume being registered causes infinite loop on SSVM, the fix is if the size is 0, return success without download --- .../com/cloud/storage/template/HttpTemplateDownloader.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/core/src/com/cloud/storage/template/HttpTemplateDownloader.java b/core/src/com/cloud/storage/template/HttpTemplateDownloader.java index 628ad64c0dc..c8aac27da8c 100644 --- a/core/src/com/cloud/storage/template/HttpTemplateDownloader.java +++ b/core/src/com/cloud/storage/template/HttpTemplateDownloader.java @@ -250,6 +250,13 @@ public class HttpTemplateDownloader implements TemplateDownloader { } } else { remoteSize2 = Long.parseLong(contentLengthHeader.getValue()); + if ( remoteSize2 == 0 ) { + status = TemplateDownloader.Status.DOWNLOAD_FINISHED; + String downloaded = "(download complete remote=" + remoteSize + "bytes)"; + errorString = "Downloaded " + totalBytes + " bytes " + downloaded; + downloadTime = 0; + return 0; + } } if (remoteSize == 0) {