zero size of template/volume being registered causes infinite loop on SSVM, the fix is if the size is 0, return success without download
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/56535a7a Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/56535a7a Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/56535a7a Branch: refs/heads/vmware-storage-motion Commit: 56535a7a83f9871f97023e84f87bc9d65aa0f868 Parents: a4d4284 Author: Anthony Xu <anthony...@citrix.com> Authored: Wed May 29 15:18:20 2013 -0700 Committer: Anthony Xu <anthony...@citrix.com> Committed: Wed May 29 15:18:20 2013 -0700 ---------------------------------------------------------------------- .../storage/template/HttpTemplateDownloader.java | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/56535a7a/core/src/com/cloud/storage/template/HttpTemplateDownloader.java ---------------------------------------------------------------------- diff --git a/core/src/com/cloud/storage/template/HttpTemplateDownloader.java b/core/src/com/cloud/storage/template/HttpTemplateDownloader.java index 628ad64..c8aac27 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) {