Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
1ee9980
Initial commit
charles-phiri May 17, 2018
9f7eff1
some code to enhance the configure method in the Service Layer
charles-phiri May 17, 2018
987534e
refactored Service interface
charles-phiri May 17, 2018
4ef4c2f
refactored Service interface
charles-phiri May 23, 2018
6256e91
refactored Service interface
charles-phiri May 23, 2018
c7e5572
refactored Service interface
charles-phiri May 23, 2018
74822ce
refactored Service interface
charles-phiri May 24, 2018
e017c1c
refactored Service interface
charles-phiri May 24, 2018
9438236
refactored Service interface
charles-phiri May 28, 2018
99bb448
refactored Service interface
charles-phiri May 28, 2018
3cdb059
refactored Service interface
charles-phiri May 28, 2018
be2d1b3
refactored Service interface
charles-phiri May 29, 2018
6c76aa9
refactored Service interface
charles-phiri May 29, 2018
1e24faa
refactored Service interface
charles-phiri May 29, 2018
ee7907c
refactored Service interface
charles-phiri May 29, 2018
65b7d38
refactored Service interface
charles-phiri May 29, 2018
182dea9
Removed unused imports
charles-phiri May 29, 2018
395b246
refactored Service interface
charles-phiri May 29, 2018
aae408c
refactored Service interface
charles-phiri May 29, 2018
a4c6d5d
This is a compiled version of the work I have been doing so far. I am…
charles-phiri May 29, 2018
e8aa68b
Changed the schema script which was having errors when deploying the DB.
charles-phiri May 29, 2018
a10c798
Minor fixes on SQL schema file
charles-phiri May 30, 2018
e0292b5
Changed the schema script which was having errors when deploying the DB.
charles-phiri May 30, 2018
64a6185
Refactored some code in the API (Cmd) class.
charles-phiri May 30, 2018
135383d
Added some more functionality in the Service Layer class.
charles-phiri May 30, 2018
2be2e9d
Removed the code that was using generics in the class DiagnosticsKey.
charles-phiri May 30, 2018
943626e
Corrected code in my DiagnosticsConfigDepotImpl class that was using …
charles-phiri May 30, 2018
e187bc1
Corrected code in my RetrieveDiagnosticsVO class that was using the g…
charles-phiri May 30, 2018
98e2aa5
Yet still, removed some code using generics code.
charles-phiri May 30, 2018
3b97954
Added more code in the Service Layer class and refactored code in the…
charles-phiri May 31, 2018
987b6f7
Refactored code in Service Impl class.
charles-phiri May 31, 2018
2ff8287
Added code in spring xml file.
charles-phiri May 31, 2018
351f721
Created my own interface class for DiagnosticsConfigDepotImpl as I co…
charles-phiri May 31, 2018
94a2fb5
Changed most of the code in the DaO and VO classes including its usag…
charles-phiri Jun 4, 2018
8b57ee6
Refactored code in the Dao and VO, and also added one more method to …
charles-phiri Jun 5, 2018
8995e4f
Cleaned up the code and refactored code so that it has some of the ch…
charles-phiri Jun 6, 2018
e6c1029
Refactored code in the Service Layer impl.
charles-phiri Jun 6, 2018
974de4a
Made some code logic changes to the Service Layer when populating the…
charles-phiri Jun 7, 2018
fc5ef6f
Addressed comments on the code.
charles-phiri Jun 7, 2018
ca4dd82
Refactored code in the Service Layer for retrieving recodes from the …
charles-phiri Jun 7, 2018
ca5c308
Added unit test file to test the functionality in the Service Layer i…
charles-phiri Jun 12, 2018
fa129fa
Added unit test file to test the functionality in the Service Layer i…
charles-phiri Jun 12, 2018
e97895f
Removed the duplicated licence information.
charles-phiri Jun 12, 2018
f525aa9
1. Cleaned up code as per Daan's comments.
charles-phiri Jun 13, 2018
3e62161
Mgt-server could be running in a vm that does not have diskOffering. …
charles-phiri Jun 14, 2018
cc880d4
Added code to check capacity of the disk space and compare it to the …
charles-phiri Jun 14, 2018
91514d4
Added code to check capacity of the disk space and compare it to the …
charles-phiri Jun 14, 2018
141ab51
Added code to check capacity of the disk space and compare it to the …
charles-phiri Jun 14, 2018
2e55ec2
Added code to check capacity of the disk space and compare it to the …
charles-phiri Jun 19, 2018
d2b2d62
Added code to check capacity of the disk space and compare it to the …
charles-phiri Jun 20, 2018
45bd812
Added code to parse for a default value which is in square brackets, …
charles-phiri Jun 21, 2018
c9d7ad2
Inserted getters/setters for the script filename variables
charles-phiri Jun 21, 2018
dd5579d
Added skeleton scripts (still adding code) to retrieve files and run …
charles-phiri Jun 26, 2018
46098bc
Added code for the two command classes (ExecuteScriptCommand and Retr…
charles-phiri Jun 27, 2018
5d22c03
Added code for the two command classes (ExecuteScriptCommand and Retr…
charles-phiri Jun 27, 2018
5086e34
Added code for the two command classes (ExecuteScriptCommand and Retr…
charles-phiri Jun 27, 2018
555cc86
Add method to check disk space
charles-phiri Jun 27, 2018
94b414d
Minor changes in unit test
charles-phiri Jun 27, 2018
0f19d46
Still working on unit test
charles-phiri Jun 28, 2018
956a434
Added more unit tests.
charles-phiri Jun 28, 2018
76e5545
Skeleton implementation of the Garbage Collector.
charles-phiri Jun 28, 2018
c458261
Refactored code while testing, mostly in the Service Layer. Added a c…
charles-phiri Jul 8, 2018
9a6c5cf
Got rid of the cyclic dependencies that I was encountering when compi…
charles-phiri Jul 10, 2018
24f123a
Merge branch 'master' of https://github.com/apache/cloudstack into re…
charles-phiri Jul 10, 2018
f66c840
Refactored code in the Service Layer and the python scripts for retri…
charles-phiri Jul 17, 2018
1e4a426
Marvin tests for the RetrieveDiagnostics API
charles-phiri Jul 19, 2018
63f6b9b
Full complete code after refactoring. Addition of copyFileFromSystemV…
charles-phiri Jul 25, 2018
3acbfe4
Code cleanup and refactoring
charles-phiri Jul 26, 2018
d08cc7b
Complete RerieveDiagnostics API implementation for testing.
charles-phiri Jul 27, 2018
3c12e07
Complete RerieveDiagnostics API .
charles-phiri Jul 27, 2018
f88bde0
Minor bug fixes.
charles-phiri Jul 29, 2018
720da4c
Code for the RetrieveDiagnostics API.
charles-phiri Aug 8, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Refactored code while testing, mostly in the Service Layer. Added a c…
…opyFileFromSystemVm method in the Service Layer to copy files from System VM using the SshHelper class
  • Loading branch information
charles-phiri committed Jul 8, 2018
commit c45826118a87655a6d75ae2a96f3c40a2703adae
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,12 @@ public class RetrieveDiagnosticsCmd extends BaseAsyncCmd {
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
@Parameter(name = ApiConstants.ID,
@Parameter(name = ApiConstants.SYSTEM_VM_TYPE,
type = CommandType.UUID,
entityType = SystemVmResponse.class,
validations = {ApiArgValidator.PositiveNumber},
required = true,
description = "The host VM type that the diagnostics files requested are to be retrieved from")
description = "the system VM type. Possible types are \"domainrouter\", \"consoleproxy\" and \"secondarystoragevm\".")
private Long systemVmId;


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,10 @@ public class VRScripts {
public static final String MONITOR_SERVICE = "monitor_service.sh";
public static final String PASSWORD = "savepassword.sh";
public static final String ROUTER_ALERTS = "getRouterAlerts.sh";
public static final String ROUTER_RETRIEVEFILES = "retrieveDiagnostics.sh";
public static final String ROUTER_RETRIEVEFILES = "retrieve_diagnostics.py";
public static final String IPTABLES_RETRIEVEFILES = "iptables.py";
public static final String IFCONFIG_RETRIEVEFILES = "ifconfig.py";
public static final String ROUTE_RETRIEVEFILES = "route.py";
public static final String RVR_CHECK = "checkrouter.sh";
public static final String VMDATA = "vmdata.py";
public static final String RVR_BUMPUP_PRI = "bumpup_priority.sh";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,13 @@
import com.cloud.agent.api.Command;
import com.cloud.agent.api.ExecuteScriptCommand;
import com.cloud.agent.api.RetrieveDiagnosticsAnswer;
import com.cloud.agent.api.RetrieveFilesCommand;
import com.cloud.agent.api.routing.NetworkElementCommand;
import com.cloud.agent.manager.Commands;
import com.cloud.capacity.Capacity;
import com.cloud.capacity.dao.CapacityDao;
import com.cloud.capacity.dao.CapacityDaoImpl;
import com.cloud.cluster.ManagementServerHostVO;
import com.cloud.cluster.dao.ManagementServerHostDao;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.OperationTimedoutException;
Expand All @@ -47,6 +48,7 @@
import com.cloud.storage.dao.DiskOfferingDao;
import com.cloud.storage.dao.VolumeDao;
import com.cloud.user.AccountManager;
import com.cloud.utils.ExecutionResult;
import com.cloud.utils.NumbersUtil;
import com.cloud.utils.Pair;
import com.cloud.utils.component.ManagerBase;
Expand All @@ -55,6 +57,7 @@
import com.cloud.utils.db.SearchBuilder;
import com.cloud.utils.db.SearchCriteria;
import com.cloud.utils.exception.CloudRuntimeException;
import com.cloud.utils.ssh.SshHelper;
import com.cloud.vm.DiskProfile;
import com.cloud.vm.SecondaryStorageVmVO;
import com.cloud.vm.VMInstanceVO;
Expand All @@ -65,6 +68,7 @@
import com.cloud.vm.dao.SecondaryStorageVmDao;
import com.cloud.vm.dao.VMInstanceDao;
import com.google.common.base.Strings;
import com.jcraft.jsch.JSchException;
import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.command.admin.diagnostics.RetrieveDiagnosticsCmd;
Expand All @@ -83,11 +87,13 @@
import org.apache.cloudstack.framework.config.impl.RetrieveDiagnosticsDao;
import org.apache.cloudstack.framework.config.impl.RetrieveDiagnosticsVO;
import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
import org.apache.commons.lang.ArrayUtils;
import org.apache.log4j.Logger;

import javax.inject.Inject;
import javax.naming.ConfigurationException;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
Expand All @@ -107,15 +113,18 @@ public class RetrieveDiagnosticsServiceImpl extends ManagerBase implements Retri
protected Map<String, Object> configParams = new HashMap<String, Object>();
private Map<String, String> _configs;

private String scriptNameRetrieve = null;

private String scriptNameRemove = null;
private String scriptName = null;

ScheduledExecutorService _executor = null;

HashMap<String, List<DiagnosticsKey>> allDefaultDiagnosticsTypeKeys = new HashMap<String, List<DiagnosticsKey>>();

private Boolean gcEnabled;
private Long interval;

private Float disableThreshold;
private String filePath;
private Long fileAge;

@Inject
private HostDao _hostDao;
Copy link
Copy Markdown
Member Author

@DaanHoogland DaanHoogland Jul 26, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please remove the underscore from the names, here and below

Copy link
Copy Markdown
Member Author

@DaanHoogland DaanHoogland Jul 26, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please remove the _ from this field and all those below

Expand All @@ -129,6 +138,9 @@ public class RetrieveDiagnosticsServiceImpl extends ManagerBase implements Retri
@Inject
private AgentManager _agentMgr;

@Inject
private ManagementServerHostDao managementServerHostDao;

@Inject
public AccountManager _accountMgr;

Expand Down Expand Up @@ -186,6 +198,16 @@ public class RetrieveDiagnosticsServiceImpl extends ManagerBase implements Retri

ConfigKey<Long> RetrieveDiagnosticsTimeOut = new ConfigKey<Long>("Advanced", Long.class, "retrieveDiagnostics.retrieval.timeout", "3600",
"The timeout setting in seconds for the overall API call", true, ConfigKey.Scope.Global);
ConfigKey<Boolean> RetrieveDiagnosticsGCEnable = new ConfigKey<Boolean>("Advanced", Boolean.class, "retrieveDiagnostics.gc.enabled", "true",
"Garbage collection on/off switch", true, ConfigKey.Scope.Global);
ConfigKey<Long> RetrieveDiagnosticsInterval = new ConfigKey<Long>("Advanced", Long.class, "retrieveDiagnostics.gc.interval", "86400",
"Interval between garbage collection execution", true, ConfigKey.Scope.Global);
ConfigKey<Float> RetrieveDiagnosticsDisableThreshold = new ConfigKey<Float>("Advanced", Float.class, "retrieveDiagnostics.disablethreshold", "0.95",
"Percentage disk space cut-off before API will fail", true, ConfigKey.Scope.Global);
ConfigKey<String> RetrieveDiagnosticsFilePath = new ConfigKey<String>("Advanced", String.class, "retrieveDiagnostics.filepath", "/tmp",
"The path to use on the management server for all temporary data", true, ConfigKey.Scope.Global);
ConfigKey<Long> RetrieveDiagnosticsFileAge = new ConfigKey<Long>("Advanced", Long.class, "retrieveDiagnostics.max.fileage", "86400",
"The Diagnostics file age in seconds before considered for garbage collection", true, ConfigKey.Scope.Global);

public RetrieveDiagnosticsServiceImpl() {
}
Expand All @@ -198,8 +220,20 @@ public boolean configure(final String name, final Map<String, Object> params) th
_configs = _configDao.getConfiguration();

_timeOut = RetrieveDiagnosticsTimeOut.value();
gcEnabled = RetrieveDiagnosticsGCEnable.value();
interval = RetrieveDiagnosticsInterval.value();
disableThreshold = RetrieveDiagnosticsDisableThreshold.value();
filePath = RetrieveDiagnosticsFilePath.value();
fileAge = RetrieveDiagnosticsFileAge.value();

if (params != null) {
params.put(RetrieveDiagnosticsTimeOut.key(), (Long)RetrieveDiagnosticsTimeOut.value());
params.put(RetrieveDiagnosticsGCEnable.key(), (Boolean)RetrieveDiagnosticsGCEnable.value());
params.put(RetrieveDiagnosticsInterval.key(), (Long)RetrieveDiagnosticsInterval.value());
params.put(RetrieveDiagnosticsDisableThreshold.key(), (Float)RetrieveDiagnosticsDisableThreshold.value());
params.put(RetrieveDiagnosticsFilePath.key(), (String)RetrieveDiagnosticsFilePath.value());
params.put(RetrieveDiagnosticsFileAge.key(), (Long)RetrieveDiagnosticsFileAge.value());

return true;
}

Expand Down Expand Up @@ -276,8 +310,7 @@ public Map<String, String> getDiagnosticsFiles(final RetrieveDiagnosticsCmd cmd)
String systemVmType = null;
String diagnosticsType = null;
String fileDetails = null;
String[] filesToRetrieve = null;
String[] listOfDiagnosticsFiles = null;
String listOfDiagnosticsFiles = null;
List<String> diagnosticsFiles = new ArrayList<>();
if (configParams == null) {
configParams = new HashMap<>();
Expand Down Expand Up @@ -305,30 +338,29 @@ public Map<String, String> getDiagnosticsFiles(final RetrieveDiagnosticsCmd cmd)
}
if (diagnosticsType == null) {
listOfDiagnosticsFiles = getAllDefaultFilesForEachSystemVm(diagnosticsType);
for (String entry : filesToRetrieve ) {
diagnosticsFiles.add(entry);
}
} else {
fileDetails = cmd.getOptionalListOfFiles();
if (fileDetails != null) {
filesToRetrieve = fileDetails.split(",");
StringBuilder filesToRetrieve = new StringBuilder();
filesToRetrieve.append(fileDetails);
listOfDiagnosticsFiles = getDefaultFilesForVm(diagnosticsType, systemVmType);
for (String entry : filesToRetrieve ) {
diagnosticsFiles.add(entry);
}
for (String defaultFileList : listOfDiagnosticsFiles) {
diagnosticsFiles.add(defaultFileList);
if (listOfDiagnosticsFiles != null) {
filesToRetrieve.append("," + listOfDiagnosticsFiles);
}
listOfDiagnosticsFiles = filesToRetrieve.toString();
} else {
//retrieve default files from diagnostics data class for the system vm
listOfDiagnosticsFiles = getDefaultFilesForVm(diagnosticsType, systemVmType);
for (String key : listOfDiagnosticsFiles) {
diagnosticsFiles.add(key);
}

}
}
Map<String, String> response = retrieveDiagnosticsFiles(cmd.getId(), diagnosticsFiles, vmInstance, RetrieveDiagnosticsTimeOut.value());
Map<String, String> response = null;
try {
response = retrieveDiagnosticsFiles(vmId, listOfDiagnosticsFiles, vmInstance, RetrieveDiagnosticsTimeOut.value());
} catch(JSchException ex) {
System.exit(1);
} catch (IOException e) {
System.exit(1);
}
if (response != null)
return response;
}
Expand All @@ -337,108 +369,98 @@ public Map<String, String> getDiagnosticsFiles(final RetrieveDiagnosticsCmd cmd)

}

protected String[] getAllDefaultFilesForEachSystemVm(String diagnosticsType) {
protected String getAllDefaultFilesForEachSystemVm(String diagnosticsType) {
StringBuilder listDefaultFilesForEachVm = new StringBuilder();
List<DiagnosticsKey> diagnosticsKey = get(diagnosticsType);
for (DiagnosticsKey key : diagnosticsKey) {
listDefaultFilesForEachVm.append(key.getDetail());
}
return listDefaultFilesForEachVm.toString().split(",");
return listDefaultFilesForEachVm.toString();
}

protected String[] getDefaultFilesForVm(String diagnosticsType, String systemVmType) {
protected String getDefaultFilesForVm(String diagnosticsType, String systemVmType) {
String listDefaultFilesForVm = null;
List<DiagnosticsKey> diagnosticsKey = allDefaultDiagnosticsTypeKeys.get(diagnosticsType);
for (DiagnosticsKey key : diagnosticsKey) {
if (key.getRole().equalsIgnoreCase(systemVmType)) {
listDefaultFilesForVm = key.getDetail();
return listDefaultFilesForVm;
}
return listDefaultFilesForVm.split(",");

}
return null;
}

public ExecutionResult copyFileFromSystemVm(final String ip, final String filename) {

protected Map<String, String> retrieveDiagnosticsFiles(Long ssHostId, List<String> diagnosticsFiles, final VMInstanceVO systemVmId, Long timeout)
throws ResourceUnavailableException, OperationTimedoutException, ConcurrentOperationException {
if (LOGGER.isInfoEnabled()) {
LOGGER.info("Retrieving diagnostics files : " + getConfigComponentName());
final File permKey = new File("/root/.ssh/id_rsa.cloud");
boolean success = true;
String details = "Copying file in System VM, with ip: " + ip + ", file: " + filename;
LOGGER.debug(details);

try {
SshHelper.scpTo(ip, 22, "root", permKey, null, null, filename.getBytes(), filename, null);
} catch (final Exception e) {
LOGGER.warn("Fail to copy file " + filename + " in System VM " + ip, e);
details = e.getMessage();
success = false;
}
return new ExecutionResult(success, details);
}

Float disableThreshold = Float.parseFloat(_configs.get("retrieveDiagnostics.disablethreshold"));
String filePath = _configs.get("retrieveDiagnostics.filepath");
Long fileAge = Long.parseLong(_configs.get("retrieveDiagnostics.max.fileage"));
Long timeIntervalGCexecution = Long.parseLong(_configs.get("retrieveDiagnostics.gc.interval"));
gcEnabled = Boolean.parseBoolean("retrieveDiagnostics.gc.enabled");
Long wait = Long.parseLong(_configDao.getValue(RetrieveDiagnosticsTimeOut.key()), 3600);
String tempStr = null;

if (ssHostId == null) {
LOGGER.info("No host selected." + getConfigComponentName());
}
if (wait <= 0) {
timeout = RetrieveDiagnosticsTimeOut.value();
}
if (filePath == null) {
filePath = "\\tmp";
}
if (fileAge == null) {
fileAge = 86400L;
}
if (disableThreshold == null) {
disableThreshold = 0.95F;
}
if (timeIntervalGCexecution == null) {
timeIntervalGCexecution = 86400L;
}
if (!gcEnabled) {
gcEnabled = true;
protected Map<String, String> retrieveDiagnosticsFiles(Long ssHostId, String diagnosticsFiles, final VMInstanceVO systemVmId, Long timeout)
throws ResourceUnavailableException, OperationTimedoutException, ConcurrentOperationException, JSchException, IOException {
if (LOGGER.isInfoEnabled()) {
LOGGER.info("Retrieving diagnostics files : " + getConfigComponentName());
}
String tempStr = null;
final Hypervisor.HypervisorType hypervisorType = systemVmId.getHypervisorType();
List<String> deleteSquareBracketedEntries = new ArrayList<>();
List<String> scripts = new ArrayList<>();
boolean isSquareBracketed = false;
Commands cmds = null;
for (String squareBracketsString : diagnosticsFiles) {
if (squareBracketsString.contains("[]")) {
isSquareBracketed = true;
deleteSquareBracketedEntries.add(squareBracketsString);
tempStr = squareBracketsString.trim().replaceAll("(^\\[(.*?)\\].*)", ("$2").trim());
if (!tempStr.equalsIgnoreCase("IPTABLES") || !tempStr.equalsIgnoreCase("IFCONFIG")) {
throw new InvalidParameterValueException("CloudStack does not support " + squareBracketsString);
}
scriptNameRetrieve = tempStr.toLowerCase().concat(".py");
scripts.add(scriptNameRetrieve);
String[] files = diagnosticsFiles.split(",");
for (int i = files.length - 1; i >= 0; i--) {
if (files[i].contains("[") || files[i].contains("]")) {
tempStr = files[i].trim().replaceAll("(^\\[(.*?)\\].*?)", ("$2").trim());
scriptName = tempStr.toLowerCase().concat(".py");
scripts.add(scriptName);
files = (String[])ArrayUtils.removeElement(files, files[i]);
}
}
if (isSquareBracketed) {
for (String deleteSquareBracketed : deleteSquareBracketedEntries) {
diagnosticsFiles.remove(deleteSquareBracketed);
}
ManagementServerHostVO managementServerHostVO = managementServerHostDao.findById(systemVmId.getHostId());
String ipHostAddress = managementServerHostVO.getServiceIP();
StringBuilder filesSpaceDelimited = new StringBuilder();
for (String file : files) {
filesSpaceDelimited.append(file);
copyFileFromSystemVm(ipHostAddress, file);
filesSpaceDelimited.append(" ");
}
String filesToRetrieveCommaSeparated = filesSpaceDelimited.toString();
cmds = new Commands(Command.OnError.Stop);
ExecuteScriptCommand execCmd = null;
final Map<String, String> accessDetails = networkManager.getSystemVMAccessDetails(systemVmId);
if (!scripts.isEmpty()) {
for (String script : scripts) {
execCmd = new ExecuteScriptCommand(script, vmManager.getExecuteInSequence(hypervisorType));
execCmd.setAccessDetail(accessDetails);
cmds.addCommand(execCmd);
}
}
final Map<String, String> accessDetails = networkManager.getSystemVMAccessDetails(systemVmId);
execCmd.setAccessDetail(accessDetails);
String filesToRetrieveCommaSeparated = String.join(",", diagnosticsFiles);
RetrieveFilesCommand retrieveFilesCommand = new RetrieveFilesCommand(filesToRetrieveCommaSeparated, vmManager.getExecuteInSequence(hypervisorType));
retrieveFilesCommand.setAccessDetail(accessDetails);
cmds.addCommand(retrieveFilesCommand);

//RetrieveFilesCommand retrieveFilesCommand = new RetrieveFilesCommand(filesToRetrieveCommaSeparated, vmManager.getExecuteInSequence(hypervisorType));
//retrieveFilesCommand.setAccessDetail(accessDetails);
//cmds.addCommand(retrieveFilesCommand);

if (Strings.isNullOrEmpty(accessDetails.get(NetworkElementCommand.ROUTER_IP))) {
throw new CloudRuntimeException("Unable to set system vm ControlIP for the system vm with ID -> " + systemVmId);
}
Map<String, String> resultsMap;
final Long hostId = systemVmId.getHostId();
_agentMgr.send(hostId, cmds);
Answer[] answers = _agentMgr.send(hostId, cmds);

if (!cmds.isSuccessful()) {
for (final Answer answer : cmds.getAnswers()) {
copyFileFromSystemVm(ipHostAddress, scriptName + ".log");
for (final Answer answer : answers) {
if (!answer.getResult()) {
LOGGER.warn("Failed to retrieve results due to: " + answer.getDetails());

Expand Down Expand Up @@ -594,7 +616,9 @@ public void cleanupDiagnostics() {
@Override
public boolean start() {
gcEnabled = Boolean.parseBoolean("retrieveDiagnostics.gc.enabled");
Long interval = Long.parseLong(_configs.get("retrieveDiagnostics.gc.interval"));
if (interval == null) {
interval = 86400L;
}
Integer cleanupInterval = (int)(long) interval;
if (!super.start()) {
return false;
Expand All @@ -618,21 +642,14 @@ public boolean stop() {
return true;
}

public String getScriptNameRetrieve() {
return scriptNameRetrieve;
}

public void setScriptNameRetrieve(String scriptNameRetrieve) {
this.scriptNameRetrieve = scriptNameRetrieve;
public String getScriptName() {
return scriptName;
}

public String getScriptNameRemove() {
return scriptNameRemove;
public void setScriptName(String scriptName) {
this.scriptName = scriptName;
}

public void setScriptNameRemove(String scriptNameRemove) {
this.scriptNameRemove = scriptNameRemove;
}


}
Loading