cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] DaanHoogland commented on a change in pull request #2447: Add retry logic to direct download and checksum, also refactoring
Date Thu, 01 Jan 1970 00:00:00 GMT
DaanHoogland commented on a change in pull request #2447: Add retry logic to direct download
and checksum, also refactoring
URL: https://github.com/apache/cloudstack/pull/2447#discussion_r166404453
 
 

 ##########
 File path: server/src/org/apache/cloudstack/direct/download/DirectDownloadManagerImpl.java
 ##########
 @@ -167,10 +210,22 @@ public void downloadTemplate(long templateId, long poolId, long hostId)
{
 
         DownloadProtocol protocol = getProtocolFromUrl(url);
         DirectDownloadCommand cmd = getDirectDownloadCommandFromProtocol(protocol, url, templateId,
to, checksum, headers);
-        Answer answer = agentManager.easySend(hostId, cmd);
-        if (answer == null || !answer.getResult()) {
-            throw new CloudRuntimeException("Host " + hostId + " could not download template
" +
-                    templateId + " on pool " + poolId);
+
+        boolean downloaded = false;
+        int retry = 3;
+        Long[] hostsToRetry = getHostsToRetryOn(host.getClusterId(), host.getDataCenterId(),
host.getHypervisorType(), hostId);
+        int hostIndex = 0;
+        Answer answer = null;
+        Long hostToSendDownloadCmd = hostsToRetry[hostIndex];
+        while (!downloaded && retry > 0) {
+            s_logger.debug("Sending Direct download command to host " + hostToSendDownloadCmd);
+            answer = agentManager.easySend(hostToSendDownloadCmd, cmd);
+            downloaded = answer != null && answer.getResult();
+            hostToSendDownloadCmd = hostsToRetry[(hostIndex + 1) % hostsToRetry.length];
 
 Review comment:
   so we try three times on possibly three different hosts? are those the ones that the deployments
are on (local storage used)?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message