GutoVeronezi commented on a change in pull request #4575:
URL: https://github.com/apache/cloudstack/pull/4575#discussion_r628321847



##########
File path: server/src/main/java/com/cloud/vm/UserVmManagerImpl.java
##########
@@ -5165,7 +5165,7 @@ public void 
doInTransactionWithoutResult(TransactionStatus status) {
                     }
                 });
             } catch (Exception e) {
-                s_logger.warn("Unable to update vm disk statistics for vm: " + 
userVm.getId() + " from host: " + hostId, e);
+                s_logger.warn(String.format("Unable to update vm disk 
statistics for vm %s from %s", userVm.getInstanceName(), host), e);

Review comment:
       ```suggestion
                   s_logger.warn(String.format("Unable to update VM disk 
statistics for vm %s from %s", userVm.getInstanceName(), host), e);
   ```

##########
File path: server/src/main/java/com/cloud/resource/ResourceManagerImpl.java
##########
@@ -903,7 +904,8 @@ public void doInTransactionWithoutResult(final 
TransactionStatus status) {
                 try {
                     resourceStateTransitTo(host, 
ResourceState.Event.DeleteHost, _nodeId);
                 } catch (final NoTransitionException e) {
-                    s_logger.debug("Cannot transmit host " + host.getId() + " 
to Enabled state", e);
+                    s_logger.debug("Cannot transit " + host + " to Enabled 
state", e);
+                    s_logger.debug(String.format("Cannot transit %s to Enabled 
state", host), e);

Review comment:
       ```suggestion
                       s_logger.debug(String.format("Cannot transit %s to 
Enabled state", host), e);
   ```

##########
File path: server/src/main/java/com/cloud/resource/ResourceManagerImpl.java
##########
@@ -2400,16 +2402,17 @@ public void deleteRoutingHost(final HostVO host, final 
boolean isForced, final b
                     // Restart HA enabled vms
                     for (final VMInstanceVO vm : vms) {
                         if (!vm.isHaEnabled() || vm.getState() == 
State.Stopping) {
-                            s_logger.debug("Stopping vm: " + vm + " as a part 
of deleteHost id=" + host.getId());
+                            s_logger.debug("Stopping vm: " + vm + " as a part 
of hostDelete: " + host);
                             try {
                                 _vmMgr.advanceStop(vm.getUuid(), false);
                             } catch (final Exception e) {
-                                final String errorMsg = "There was an error 
stopping the vm: " + vm + " as a part of hostDelete id=" + host.getId();
+                                final String errorMsg = String.format("There 
was an error stopping the vm: %s as a part of hostDelete: %s", vm, host);
                                 s_logger.debug(errorMsg, e);
                                 throw new UnableDeleteHostException(errorMsg + 
"," + e.getMessage());
                             }
                         } else if (vm.isHaEnabled() && (vm.getState() == 
State.Running || vm.getState() == State.Starting)) {
-                            s_logger.debug("Scheduling restart for vm: " + vm 
+ " " + vm.getState() + " on the host id=" + host.getId());
+                            s_logger.debug("Scheduling restart for vm: " + vm 
+ " " + vm.getState() + " on host: " + host);
+                            s_logger.debug(String.format("Scheduling restart 
for vm: %s, state: %s on host: %s.", vm, vm.getState(), host));

Review comment:
       ```suggestion
                               s_logger.debug(String.format("Scheduling restart 
for VM: %s, state: %s on host: %s.", vm, vm.getState(), host));
   ```

##########
File path: server/src/main/java/com/cloud/resource/ResourceManagerImpl.java
##########
@@ -2400,16 +2402,17 @@ public void deleteRoutingHost(final HostVO host, final 
boolean isForced, final b
                     // Restart HA enabled vms
                     for (final VMInstanceVO vm : vms) {
                         if (!vm.isHaEnabled() || vm.getState() == 
State.Stopping) {
-                            s_logger.debug("Stopping vm: " + vm + " as a part 
of deleteHost id=" + host.getId());
+                            s_logger.debug("Stopping vm: " + vm + " as a part 
of hostDelete: " + host);

Review comment:
       ```suggestion
                               s_logger.debug("Stopping VM: " + vm + " as a 
part of hostDelete: " + host);
   ```

##########
File path: server/src/main/java/com/cloud/resource/ResourceManagerImpl.java
##########
@@ -2400,16 +2402,17 @@ public void deleteRoutingHost(final HostVO host, final 
boolean isForced, final b
                     // Restart HA enabled vms
                     for (final VMInstanceVO vm : vms) {
                         if (!vm.isHaEnabled() || vm.getState() == 
State.Stopping) {
-                            s_logger.debug("Stopping vm: " + vm + " as a part 
of deleteHost id=" + host.getId());
+                            s_logger.debug("Stopping vm: " + vm + " as a part 
of hostDelete: " + host);
                             try {
                                 _vmMgr.advanceStop(vm.getUuid(), false);
                             } catch (final Exception e) {
-                                final String errorMsg = "There was an error 
stopping the vm: " + vm + " as a part of hostDelete id=" + host.getId();
+                                final String errorMsg = String.format("There 
was an error stopping the vm: %s as a part of hostDelete: %s", vm, host);

Review comment:
       ```suggestion
                                   final String errorMsg = String.format("There 
was an error stopping the VM: %s as a part of hostDelete: %s", vm, host);
   ```

##########
File path: 
server/src/main/java/com/cloud/resource/RollingMaintenanceManagerImpl.java
##########
@@ -537,7 +539,7 @@ private boolean isMaintenanceScriptDefinedOnHost(Host host, 
List<HostSkipped> ho
                 answer = agentManager.send(host.getId(), cmd);
             } catch (AgentUnavailableException | OperationTimedoutException e) 
{
                 // Agent may be restarted on the scripts - continue polling 
until it is up
-                String msg = "Cannot send command to host: " + host.getId() + 
", waiting " + pingInterval + "ms - " + e.getMessage();
+                String msg = String.format("Cannot send command to %s, waiting 
%sms - %s", host, pingInterval, e.getMessage());
                 s_logger.warn(msg);

Review comment:
       ```suggestion
                   s_logger.warn(msg, e);
   ```

##########
File path: server/src/main/java/com/cloud/resource/ResourceManagerImpl.java
##########
@@ -2385,7 +2387,7 @@ public void deleteRoutingHost(final HostVO host, final 
boolean isForced, final b
                     try {
                         _vmMgr.destroy(vm.getUuid(), false);
                     } catch (final Exception e) {
-                        final String errorMsg = "There was an error Destory 
the vm: " + vm + " as a part of hostDelete id=" + host.getId();
+                        final String errorMsg = String.format("There was an 
error when destroying the vm: %s as a part of hostDelete: %s", vm, host);

Review comment:
       ```suggestion
                           String errorMsg = String.format("There was an error 
when destroying the VM: %s as a part of hostDelete: %s", vm, host);
   ```




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to