JoaoJandre commented on code in PR #14711:
URL: https://github.com/apache/cloudstack/pull/14711#discussion_r4633337574


##########
plugins/backup/kboss/src/main/java/org/apache/cloudstack/backup/KbossBackupProvider.java:
##########
@@ -2645,14 +2645,24 @@ protected void 
updateReferencesAfterPrepareForSnapshotRevert(List<DeltaMergeTree
         setEndOfChainAndRemoveCurrentForBackup(backupVO);
     }
 
+    private int getBackupTimeout(long hostId) {
+        HostVO host = hostDao.findById(hostId);
+        if (host == null) {
+            logger.trace("Unable to find host [{}] to resolve the zone-level 
[{}]; using the global value.", hostId, backupTimeout.key());
+            return backupTimeout.value();
+        }
+        return backupTimeout.valueIn(host.getDataCenterId());
+    }
+
     protected Answer sendBackupCommand(long hostId, Command cmd) {

Review Comment:
   Most places where this method is called already have a HostVO reference. It 
would be best to change the method to receive a HostVO, or receive a zoneId.  
This way we avoid an extra DB call.



##########
plugins/backup/kboss/src/main/java/org/apache/cloudstack/backup/KbossBackupProvider.java:
##########
@@ -2645,14 +2645,24 @@ protected void 
updateReferencesAfterPrepareForSnapshotRevert(List<DeltaMergeTree
         setEndOfChainAndRemoveCurrentForBackup(backupVO);
     }
 
+    private int getBackupTimeout(long hostId) {
+        HostVO host = hostDao.findById(hostId);
+        if (host == null) {
+            logger.trace("Unable to find host [{}] to resolve the zone-level 
[{}]; using the global value.", hostId, backupTimeout.key());
+            return backupTimeout.value();
+        }
+        return backupTimeout.valueIn(host.getDataCenterId());
+    }
+
     protected Answer sendBackupCommand(long hostId, Command cmd) {
-        cmd.setWait(backupTimeout.value());
+        cmd.setWait(getBackupTimeout(hostId));
         return agentManager.easySend(hostId, cmd);
     }
 
     protected Answer[] sendBackupCommands(Long hostId, Commands cmds) throws 
OperationTimedoutException, AgentUnavailableException {
+        int backupTimeoutValue = getBackupTimeout(hostId);

Review Comment:
   Same here



-- 
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