DaanHoogland commented on a change in pull request #3350: Retrieve diagnostics
data rebase
URL: https://github.com/apache/cloudstack/pull/3350#discussion_r287328447
##########
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()));
+ }
+
+ // Copy zip file from system VM to secondary storage
+ String zipFileInSystemVm = zipFilesAnswer.getDetails().replace("\n",
"");
+ Pair<Boolean, String> copyToSecondaryStorageResults =
copyZipFileToSecondaryStorage(vmInstance, vmHostId, zipFileInSystemVm, store);
+
+ // Send cleanup zip file cleanup command to system VM
Review comment:
again: comment <= statement --> remove comment
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services