server: Fix String.format arguments (#3980)

Simple log fix. I have found out a few log messages that hold unused/misused arguments on their respective String.format building.
This commit is contained in:
Gabriel Beims Bräscher 2020-06-12 01:58:04 -03:00 committed by GitHub
parent 9727548dbc
commit 6e47c49fbf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 6 deletions

View File

@ -205,7 +205,7 @@ public class BareMetalDiscoverer extends DiscovererBase implements Discoverer, R
zone.setDhcpProvider(Network.Provider.ExternalDhcpServer.getName());
_dcDao.update(zone.getId(), zone);
s_logger.debug(String.format("Discover Bare Metal host successfully(ip=%1$s, username=%2$s, password=%3%s," +
s_logger.debug(String.format("Discover Bare Metal host successfully(ip=%1$s, username=%2$s, password=%3$s," +
"cpuNum=%4$s, cpuCapacity-%5$s, memCapacity=%6$s)", ipmiIp, username, "******", cpuNum, cpuCapacity, memCapacity));
return resources;
} catch (Exception e) {

View File

@ -225,7 +225,7 @@ public class LdapListUsersCmd extends BaseListCmd {
rc = true;
} else {
if(s_logger.isTraceEnabled()) {
s_logger.trace(String.format("ldap user %s does not match cloudstack user", ldapUser.getUsername(), cloudstackUser.getUsername()));
s_logger.trace(String.format("ldap user %s does not match cloudstack user %s", ldapUser.getUsername(), cloudstackUser.getUsername()));
}
}
}
@ -242,12 +242,12 @@ public class LdapListUsersCmd extends BaseListCmd {
for (final UserResponse cloudstackUser : cloudstackUsers) {
if (ldapUser.getUsername().equals(cloudstackUser.getUsername())) {
if(s_logger.isTraceEnabled()) {
s_logger.trace(String.format("found user %s in cloudstack", ldapUser.getUsername()));
s_logger.trace(String.format("found user %s in cloudstack user %s", ldapUser.getUsername(), cloudstackUser.getUsername()));
}
return true;
} else {
if(s_logger.isTraceEnabled()) {
s_logger.trace(String.format("ldap user %s does not match cloudstack user", ldapUser.getUsername(), cloudstackUser.getUsername()));
s_logger.trace(String.format("ldap user %s does not match cloudstack user %s", ldapUser.getUsername(), cloudstackUser.getUsername()));
}
}
}

View File

@ -405,10 +405,10 @@ public class VmImportManagerImpl implements VmImportService {
final Integer memory = instance.getMemory();
Integer cpuSpeed = instance.getCpuSpeed() == null ? 0 : instance.getCpuSpeed();
if (cpu == null || cpu == 0) {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, String.format("CPU cores for VM not valid"));
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, String.format("CPU cores for VM (%s) not valid", instance.getName()));
}
if (memory == null || memory == 0) {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, String.format("Memory for VM not valid", instance.getName()));
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, String.format("Memory for VM (%s) not valid", instance.getName()));
}
if (serviceOffering.isDynamic()) {
if (details.containsKey(VmDetailConstants.CPU_SPEED)) {