Damans227 commented on code in PR #13934:
URL: https://github.com/apache/cloudstack/pull/13934#discussion_r4296727148


##########
core/src/main/java/org/apache/cloudstack/direct/download/MetalinkDirectTemplateDownloader.java:
##########
@@ -154,8 +154,9 @@ public Long getRemoteFileSize(String metalinkUrl, String 
format) {
             if (url.endsWith("torrent")) {
                 continue;
             }
-            if (downloader.checkUrl(url)) {
-                return downloader.getRemoteFileSize(url, format);
+            DirectTemplateDownloader urlDownloader = 
createDownloaderForMetalinks(url, null, null, null, headers, connectTimeout, 
soTimeout, null, null);
+            if (urlDownloader != null && urlDownloader.checkUrl(url)) {
+                return urlDownloader.getRemoteFileSize(url, format);

Review Comment:
   is this reached on the url check? a metalink link starting with http gets 
the plain http checker, so the size is still read from the metalink file 
itself. thats likely why kiran still sees 6580590 TB



##########
core/src/main/java/org/apache/cloudstack/direct/download/NfsDirectTemplateDownloader.java:
##########
@@ -66,12 +82,18 @@ public NfsDirectTemplateDownloader(String url, String 
destPool, Long templateId,
     @Override
     public Pair<Boolean, String> downloadTemplate() {
         String mountSrcUuid = UUID.randomUUID().toString();
-        String mount = String.format(mountCommand, srcHost + ":" + srcPath, 
"/mnt/" + mountSrcUuid);
+        String mountPoint = "/mnt/" + mountSrcUuid;
+        String mount = String.format(mountCommand, srcHost + ":" + srcPath, 
mountPoint);
         Script.runSimpleBashScript(mount);

Review Comment:
   should this create the mount folder first like the size check does? kirans 
log shows the mount failing with "mount point does not exist"



##########
core/src/main/java/org/apache/cloudstack/direct/download/NfsDirectTemplateDownloader.java:
##########
@@ -66,12 +82,18 @@ public NfsDirectTemplateDownloader(String url, String 
destPool, Long templateId,
     @Override
     public Pair<Boolean, String> downloadTemplate() {
         String mountSrcUuid = UUID.randomUUID().toString();
-        String mount = String.format(mountCommand, srcHost + ":" + srcPath, 
"/mnt/" + mountSrcUuid);
+        String mountPoint = "/mnt/" + mountSrcUuid;
+        String mount = String.format(mountCommand, srcHost + ":" + srcPath, 
mountPoint);
         Script.runSimpleBashScript(mount);
         String downloadDir = getDestPoolPath() + File.separator + 
getDirectDownloadTempPath(getTemplateId());

Review Comment:
   what happens when this runs from a metalink? the nfs downloader there is 
made without the pool or template id, so the copy goes to 
null/null/template/n/null



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to