You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by GitBox <gi...@apache.org> on 2019/05/24 12:36:47 UTC

[GitHub] [cloudstack] DaanHoogland commented on a change in pull request #3350: Retrieve diagnostics data rebase

DaanHoogland commented on a change in pull request #3350: Retrieve diagnostics data rebase
URL: https://github.com/apache/cloudstack/pull/3350#discussion_r287328079
 
 

 ##########
 File path: server/src/main/java/org/apache/cloudstack/diagnostics/DiagnosticsServiceImpl.java
 ##########
 @@ -126,10 +191,333 @@ protected String prepareShellCmd(String cmdType, String ipAddress, String option
         }
     }
 
+    @Override
+    @ActionEvent(eventType = EventTypes.EVENT_SYSTEM_VM_DIAGNOSTICS, eventDescription = "getting diagnostics files on system vm", async = true)
+    public String getDiagnosticsDataCommand(GetDiagnosticsDataCmd cmd) {
+        Long vmId = cmd.getId();
+        List<String> optionalFilesList = cmd.getFilesList();
+        VMInstanceVO vmInstance = getSystemVMInstance(vmId);
+        long zoneId = vmInstance.getDataCenterId();
+
+        List<String> fileList = getFileListToBeRetrieved(optionalFilesList, vmInstance);
+
+        if (CollectionUtils.isEmpty(fileList)) {
+            throw new CloudRuntimeException("Failed to generate diagnostics file list for retrieval.");
+        }
+
+        Long vmHostId = vmInstance.getHostId();
+
+        // Find Secondary Storage with enough Disk Quota in the current Zone
+        final DataStore store = getImageStore(vmInstance.getDataCenterId());
+
+        Answer zipFilesAnswer = zipDiagnosticsFilesInSystemVm(vmInstance, fileList);
+
+        if (zipFilesAnswer == null) {
+            throw new CloudRuntimeException(String.format("Failed to generate diagnostics zip file in VM %s", vmInstance.getUuid()));
+        }
+
+        if (!zipFilesAnswer.getResult()) {
+            throw new CloudRuntimeException(String.format("Failed to generate diagnostics zip file file in VM %s due to %s", vmInstance.getUuid(), zipFilesAnswer.getDetails()));
 
 Review comment:
   "file file" in the message seems redundant

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services