You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by nv...@apache.org on 2022/04/28 16:01:23 UTC

[cloudstack] branch main updated: Improve log when live patching fails (#6324)

This is an automated email from the ASF dual-hosted git repository.

nvazquez pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudstack.git


The following commit(s) were added to refs/heads/main by this push:
     new 923a5a4425 Improve log when live patching fails (#6324)
923a5a4425 is described below

commit 923a5a4425fe6e8263ab17ca6a39ecd6d3695531
Author: Pearl Dsilva <pe...@gmail.com>
AuthorDate: Thu Apr 28 21:31:15 2022 +0530

    Improve log when live patching fails (#6324)
---
 utils/src/main/java/com/cloud/utils/FileUtil.java | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/utils/src/main/java/com/cloud/utils/FileUtil.java b/utils/src/main/java/com/cloud/utils/FileUtil.java
index 3a44127fe1..d9bf081768 100644
--- a/utils/src/main/java/com/cloud/utils/FileUtil.java
+++ b/utils/src/main/java/com/cloud/utils/FileUtil.java
@@ -38,7 +38,7 @@ public class FileUtil {
     }
 
     public static void scpPatchFiles(String controlIp, String destPath, int sshPort, File pemFile, String[] files, String basePath) {
-        String errMsg = "Failed to scp files to system VM";
+        String finalErrMsg = "";
         List<String> srcFiles = Arrays.asList(files);
         srcFiles = srcFiles.stream()
                 .map(file -> basePath + file) // Using Lambda notation to update the entries
@@ -50,10 +50,11 @@ public class FileUtil {
                         destPath, newSrcFiles, "0755");
                 return;
             } catch (Exception e) {
-                errMsg += ", retrying";
-                s_logger.error(errMsg);
+                finalErrMsg = String.format("Failed to scp files to system VM due to, %s",
+                        e.getCause() != null ? e.getCause().getLocalizedMessage() : e.getLocalizedMessage());
+                s_logger.error(finalErrMsg);
             }
         }
-        throw new CloudRuntimeException(errMsg);
+        throw new CloudRuntimeException(finalErrMsg);
     }
 }