Fixed log messages
diff --git a/engine/components-api/src/main/java/com/cloud/agent/AgentManager.java b/engine/components-api/src/main/java/com/cloud/agent/AgentManager.java
index c810fdf..f7a000f 100644
--- a/engine/components-api/src/main/java/com/cloud/agent/AgentManager.java
+++ b/engine/components-api/src/main/java/com/cloud/agent/AgentManager.java
@@ -51,7 +51,7 @@
"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 {
diff --git a/engine/orchestration/src/main/java/com/cloud/agent/manager/AgentManagerImpl.java b/engine/orchestration/src/main/java/com/cloud/agent/manager/AgentManagerImpl.java
index 74494dd..d15e5ea 100644
--- a/engine/orchestration/src/main/java/com/cloud/agent/manager/AgentManagerImpl.java
+++ b/engine/orchestration/src/main/java/com/cloud/agent/manager/AgentManagerImpl.java
@@ -430,7 +430,6 @@
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 @@
}
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 @@
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 @@
}
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 @@
}
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();
}
diff --git a/server/src/main/java/com/cloud/configuration/ConfigurationManagerImpl.java b/server/src/main/java/com/cloud/configuration/ConfigurationManagerImpl.java
index e2d2fca..16aa168 100644
--- a/server/src/main/java/com/cloud/configuration/ConfigurationManagerImpl.java
+++ b/server/src/main/java/com/cloud/configuration/ConfigurationManagerImpl.java
@@ -1389,13 +1389,13 @@
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 @@
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);
}
}
diff --git a/server/src/test/java/com/cloud/configuration/ConfigurationManagerTest.java b/server/src/test/java/com/cloud/configuration/ConfigurationManagerTest.java
index d9143ac..86ce9b7 100644
--- a/server/src/test/java/com/cloud/configuration/ConfigurationManagerTest.java
+++ b/server/src/test/java/com/cloud/configuration/ConfigurationManagerTest.java
@@ -1442,7 +1442,7 @@
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);
}
}