|
47 | 47 | import com.cloud.agent.api.Answer; |
48 | 48 | import com.cloud.agent.api.storage.DownloadAnswer; |
49 | 49 | import com.cloud.agent.api.storage.DownloadCommand; |
| 50 | +import com.cloud.agent.api.storage.DownloadCommand.Proxy; |
50 | 51 | import com.cloud.agent.api.storage.DownloadProgressCommand; |
51 | 52 | import com.cloud.agent.api.storage.DownloadProgressCommand.RequestType; |
52 | 53 | import com.cloud.exception.InternalErrorException; |
@@ -421,7 +422,7 @@ public Status getDownloadStatus(String jobId) { |
421 | 422 | } |
422 | 423 |
|
423 | 424 | @Override |
424 | | - public String downloadPublicTemplate(long id, String url, String name, ImageFormat format, boolean hvm, Long accountId, String descr, String cksum, String installPathPrefix, String user, String password, long maxTemplateSizeInBytes) { |
| 425 | + public String downloadPublicTemplate(long id, String url, String name, ImageFormat format, boolean hvm, Long accountId, String descr, String cksum, String installPathPrefix, String user, String password, long maxTemplateSizeInBytes, Proxy proxy) { |
425 | 426 | UUID uuid = UUID.randomUUID(); |
426 | 427 | String jobId = uuid.toString(); |
427 | 428 | String tmpDir = installPathPrefix + File.separator + accountId + File.separator + id; |
@@ -452,7 +453,7 @@ public String downloadPublicTemplate(long id, String url, String name, ImageForm |
452 | 453 | TemplateDownloader td; |
453 | 454 | if ((uri != null) && (uri.getScheme() != null)) { |
454 | 455 | if (uri.getScheme().equalsIgnoreCase("http") || uri.getScheme().equalsIgnoreCase("https")) { |
455 | | - td = new HttpTemplateDownloader(_storage, url, tmpDir, new Completion(jobId), maxTemplateSizeInBytes, user, password); |
| 456 | + td = new HttpTemplateDownloader(_storage, url, tmpDir, new Completion(jobId), maxTemplateSizeInBytes, user, password, proxy); |
456 | 457 | } else if (uri.getScheme().equalsIgnoreCase("file")) { |
457 | 458 | td = new LocalTemplateDownloader(_storage, url, tmpDir, maxTemplateSizeInBytes, new Completion(jobId)); |
458 | 459 | } else if (uri.getScheme().equalsIgnoreCase("scp")) { |
@@ -582,7 +583,7 @@ public DownloadAnswer handleDownloadCommand(SecondaryStorageResource resource, D |
582 | 583 | } |
583 | 584 |
|
584 | 585 | long maxDownloadSizeInBytes = (cmd.getMaxDownloadSizeInBytes() == null) ? TemplateDownloader.DEFAULT_MAX_TEMPLATE_SIZE_IN_BYTES : (cmd.getMaxDownloadSizeInBytes()); |
585 | | - String jobId = downloadPublicTemplate(cmd.getId(), cmd.getUrl(), cmd.getName(), cmd.getFormat(), cmd.isHvm(), cmd.getAccountId(), cmd.getDescription(), cmd.getChecksum(), installPathPrefix, user, password, maxDownloadSizeInBytes); |
| 586 | + String jobId = downloadPublicTemplate(cmd.getId(), cmd.getUrl(), cmd.getName(), cmd.getFormat(), cmd.isHvm(), cmd.getAccountId(), cmd.getDescription(), cmd.getChecksum(), installPathPrefix, user, password, maxDownloadSizeInBytes, cmd.getProxy()); |
586 | 587 | sleep(); |
587 | 588 | if (jobId == null) { |
588 | 589 | return new DownloadAnswer("Internal Error", VMTemplateStorageResourceAssoc.Status.DOWNLOAD_ERROR); |
|
0 commit comments