Skip to content

Commit 58b66f6

Browse files
Fixed log messages
1 parent f603974 commit 58b66f6

File tree

4 files changed

+9
-12
lines changed

4 files changed

+9
-12
lines changed

engine/components-api/src/main/java/com/cloud/agent/AgentManager.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public interface AgentManager {
5151
"60", "Time in seconds to wait for Ready command to return", true);
5252

5353
ConfigKey<String> GranularWaitTimeForCommands = new ConfigKey<>("Advanced", String.class, "commands.timeout", "",
54-
"This timeout overrides the wait global config. This holds a comma separated key value pairs containing timeout for specific commands. " +
54+
"This timeout overrides the wait global config. This holds a comma separated key value pairs containing timeout (in seconds) for specific commands. " +
5555
"For example: DhcpEntryCommand=600, SavePasswordCommand=300, VmDataCommand=300", true);
5656

5757
public enum TapAgentsAction {

engine/orchestration/src/main/java/com/cloud/agent/manager/AgentManagerImpl.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,6 @@ protected int getTimeout(final Commands commands, int timeout) {
430430
if (timeout > 0) {
431431
result = timeout;
432432
} else {
433-
logger.debug(String.format("Considering the Wait global setting %d, since wait time set on command is 0", Wait.value()));
434433
result = Wait.value();
435434
}
436435

@@ -439,7 +438,6 @@ protected int getTimeout(final Commands commands, int timeout) {
439438
}
440439

441440
protected int getTimeoutFromGranularWaitTime(final Commands commands) {
442-
logger.debug("Looking for the commands.timeout global setting for any command-specific timeout value");
443441
String commandWaits = GranularWaitTimeForCommands.value().trim();
444442

445443
int maxWait = 0;
@@ -452,7 +450,6 @@ protected int getTimeoutFromGranularWaitTime(final Commands commands) {
452450
Integer commandTimeout = commandTimeouts.get(simpleCommandName);
453451

454452
if (commandTimeout != null) {
455-
logger.debug(String.format("Timeout %d found for command %s in commands.timeout global setting", commandTimeout, cmd.toString()));
456453
if (commandTimeout > maxWait) {
457454
maxWait = commandTimeout;
458455
}
@@ -492,6 +489,7 @@ public Answer[] send(final Long hostId, final Commands commands, int timeout) th
492489
}
493490

494491
int wait = getTimeout(commands, timeout);
492+
logger.debug(String.format("Wait time setting on %s is %d seconds", commands, wait));
495493
for (Command cmd : commands) {
496494
cmd.setWait(wait);
497495
}
@@ -1055,7 +1053,6 @@ public Answer[] send(final Long hostId, final Commands cmds) throws AgentUnavail
10551053
}
10561054

10571055
for (final Command cmd : cmds) {
1058-
logger.debug(String.format("Wait time set on the command %s is %d", cmd, cmd.getWait()));
10591056
if (cmd.getWait() > wait) {
10601057
wait = cmd.getWait();
10611058
}

server/src/main/java/com/cloud/configuration/ConfigurationManagerImpl.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1389,39 +1389,39 @@ protected Pair<Boolean, String> validateCommaSeparatedKeyValueConfigWithPositive
13891389
for (String command : commands) {
13901390
command = command.trim();
13911391
if (!command.contains("=")) {
1392-
String errorMessage = "Validation failed: Command '" + command + "' does not contain '='.";
1392+
String errorMessage = String.format("Validation failed: Command '%s' does not contain '='.", command);
13931393
return new Pair<>(false, errorMessage);
13941394
}
13951395

13961396
String[] parts = command.split("=");
13971397
if (parts.length != 2) {
1398-
String errorMessage = "Validation failed: Command '" + command + "' is not properly formatted.";
1398+
String errorMessage = String.format("Validation failed: Command '%s' is not properly formatted.", command);
13991399
return new Pair<>(false, errorMessage);
14001400
}
14011401

14021402
String commandName = parts[0].trim();
14031403
String valueString = parts[1].trim();
14041404

14051405
if (commandName.isEmpty()) {
1406-
String errorMessage = "Validation failed: Command name is missing in '" + command + "'.";
1406+
String errorMessage = String.format("Validation failed: Command name is missing in '%s'.", commandName);
14071407
return new Pair<>(false, errorMessage);
14081408
}
14091409

14101410
try {
14111411
int num = Integer.parseInt(valueString);
14121412
if (num <= 0) {
1413-
String errorMessage = "Validation failed: The value for command '" + commandName + "' is not greater than 0. Invalid value: " + num;
1413+
String errorMessage = String.format("Validation failed: The value for command '%s' is not greater than 0. Invalid value: %d", commandName, num);
14141414
return new Pair<>(false, errorMessage);
14151415
}
14161416
} catch (NumberFormatException e) {
1417-
String errorMessage = "Validation failed: The value for command '" + commandName + "' is not a valid integer. Invalid value: " + valueString;
1417+
String errorMessage = String.format("Validation failed: The value for command '%s' is not a valid integer. Invalid value: %s", commandName, valueString);
14181418
return new Pair<>(false, errorMessage);
14191419
}
14201420
}
14211421

14221422
return new Pair<>(true, "");
14231423
} catch (Exception e) {
1424-
String errorMessage = "Validation failed: An error occurred while parsing the command string. Error: " + e.getMessage();
1424+
String errorMessage = String.format("Validation failed: An error occurred while parsing the command string. Error: %s", e.getMessage());
14251425
return new Pair<>(false, errorMessage);
14261426
}
14271427
}

server/src/test/java/com/cloud/configuration/ConfigurationManagerTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1442,7 +1442,7 @@ public void testValidateSpecificConfigurationValues_ValidFormatWithPositiveInteg
14421442
try {
14431443
configurationMgr.validateSpecificConfigurationValues(name, validValue, String.class);
14441444
} catch (InvalidParameterValueException e) {
1445-
Assert.fail("Exception should not be thrown for a valid command string with positive integers.");
1445+
Assert.fail("Exception should not be thrown for a valid command string with positive integers, but there is an error " + e);
14461446
}
14471447
}
14481448

0 commit comments

Comments
 (0)