mirror of https://github.com/apache/cloudstack.git
Fixed log messages
This commit is contained in:
parent
f881ab5a7b
commit
76abf5dde0
|
|
@ -51,7 +51,7 @@ public interface AgentManager {
|
|||
"60", "Time in seconds to wait for Ready command to return", true);
|
||||
|
||||
ConfigKey<String> GranularWaitTimeForCommands = new ConfigKey<>("Advanced", String.class, "commands.timeout", "",
|
||||
"This timeout overrides the wait global config. This holds a comma separated key value pairs containing timeout for specific commands. " +
|
||||
"This timeout overrides the wait global config. This holds a comma separated key value pairs containing timeout (in seconds) for specific commands. " +
|
||||
"For example: DhcpEntryCommand=600, SavePasswordCommand=300, VmDataCommand=300", true);
|
||||
|
||||
public enum TapAgentsAction {
|
||||
|
|
|
|||
|
|
@ -430,7 +430,6 @@ public class AgentManagerImpl extends ManagerBase implements AgentManager, Handl
|
|||
if (timeout > 0) {
|
||||
result = timeout;
|
||||
} else {
|
||||
logger.debug(String.format("Considering the Wait global setting %d, since wait time set on command is 0", Wait.value()));
|
||||
result = Wait.value();
|
||||
}
|
||||
|
||||
|
|
@ -439,7 +438,6 @@ public class AgentManagerImpl extends ManagerBase implements AgentManager, Handl
|
|||
}
|
||||
|
||||
protected int getTimeoutFromGranularWaitTime(final Commands commands) {
|
||||
logger.debug("Looking for the commands.timeout global setting for any command-specific timeout value");
|
||||
String commandWaits = GranularWaitTimeForCommands.value().trim();
|
||||
|
||||
int maxWait = 0;
|
||||
|
|
@ -452,7 +450,6 @@ public class AgentManagerImpl extends ManagerBase implements AgentManager, Handl
|
|||
Integer commandTimeout = commandTimeouts.get(simpleCommandName);
|
||||
|
||||
if (commandTimeout != null) {
|
||||
logger.debug(String.format("Timeout %d found for command %s in commands.timeout global setting", commandTimeout, cmd.toString()));
|
||||
if (commandTimeout > maxWait) {
|
||||
maxWait = commandTimeout;
|
||||
}
|
||||
|
|
@ -492,6 +489,7 @@ public class AgentManagerImpl extends ManagerBase implements AgentManager, Handl
|
|||
}
|
||||
|
||||
int wait = getTimeout(commands, timeout);
|
||||
logger.debug(String.format("Wait time setting on %s is %d seconds", commands, wait));
|
||||
for (Command cmd : commands) {
|
||||
cmd.setWait(wait);
|
||||
}
|
||||
|
|
@ -1055,7 +1053,6 @@ public class AgentManagerImpl extends ManagerBase implements AgentManager, Handl
|
|||
}
|
||||
|
||||
for (final Command cmd : cmds) {
|
||||
logger.debug(String.format("Wait time set on the command %s is %d", cmd, cmd.getWait()));
|
||||
if (cmd.getWait() > wait) {
|
||||
wait = cmd.getWait();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1389,13 +1389,13 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
|
|||
for (String command : commands) {
|
||||
command = command.trim();
|
||||
if (!command.contains("=")) {
|
||||
String errorMessage = "Validation failed: Command '" + command + "' does not contain '='.";
|
||||
String errorMessage = String.format("Validation failed: Command '%s' does not contain '='.", command);
|
||||
return new Pair<>(false, errorMessage);
|
||||
}
|
||||
|
||||
String[] parts = command.split("=");
|
||||
if (parts.length != 2) {
|
||||
String errorMessage = "Validation failed: Command '" + command + "' is not properly formatted.";
|
||||
String errorMessage = String.format("Validation failed: Command '%s' is not properly formatted.", command);
|
||||
return new Pair<>(false, errorMessage);
|
||||
}
|
||||
|
||||
|
|
@ -1403,25 +1403,25 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
|
|||
String valueString = parts[1].trim();
|
||||
|
||||
if (commandName.isEmpty()) {
|
||||
String errorMessage = "Validation failed: Command name is missing in '" + command + "'.";
|
||||
String errorMessage = String.format("Validation failed: Command name is missing in '%s'.", commandName);
|
||||
return new Pair<>(false, errorMessage);
|
||||
}
|
||||
|
||||
try {
|
||||
int num = Integer.parseInt(valueString);
|
||||
if (num <= 0) {
|
||||
String errorMessage = "Validation failed: The value for command '" + commandName + "' is not greater than 0. Invalid value: " + num;
|
||||
String errorMessage = String.format("Validation failed: The value for command '%s' is not greater than 0. Invalid value: %d", commandName, num);
|
||||
return new Pair<>(false, errorMessage);
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
String errorMessage = "Validation failed: The value for command '" + commandName + "' is not a valid integer. Invalid value: " + valueString;
|
||||
String errorMessage = String.format("Validation failed: The value for command '%s' is not a valid integer. Invalid value: %s", commandName, valueString);
|
||||
return new Pair<>(false, errorMessage);
|
||||
}
|
||||
}
|
||||
|
||||
return new Pair<>(true, "");
|
||||
} catch (Exception e) {
|
||||
String errorMessage = "Validation failed: An error occurred while parsing the command string. Error: " + e.getMessage();
|
||||
String errorMessage = String.format("Validation failed: An error occurred while parsing the command string. Error: %s", e.getMessage());
|
||||
return new Pair<>(false, errorMessage);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1442,7 +1442,7 @@ public class ConfigurationManagerTest {
|
|||
try {
|
||||
configurationMgr.validateSpecificConfigurationValues(name, validValue, String.class);
|
||||
} catch (InvalidParameterValueException e) {
|
||||
Assert.fail("Exception should not be thrown for a valid command string with positive integers.");
|
||||
Assert.fail("Exception should not be thrown for a valid command string with positive integers, but there is an error " + e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue