You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by GitBox <gi...@apache.org> on 2021/09/14 17:29:08 UTC

[GitHub] [cloudstack] GabrielBrascher commented on a change in pull request #5353: Improve VMWare logs

GabrielBrascher commented on a change in pull request #5353:
URL: https://github.com/apache/cloudstack/pull/5353#discussion_r708482964



##########
File path: plugins/hypervisors/vmware/src/main/java/com/cloud/hypervisor/vmware/resource/VmwareResource.java
##########
@@ -2441,33 +2434,24 @@ protected StartAnswer execute(StartCommand cmd) {
 
             return startAnswer;
         } catch (Throwable e) {
-            if (e instanceof RemoteException) {
-                s_logger.warn("Encounter remote exception to vCenter, invalidate VMware session context");
-                invalidateServiceContext();
-            }
-
-            String msg = "StartCommand failed due to " + VmwareHelper.getExceptionMessage(e);
-            s_logger.warn(msg, e);
-            StartAnswer startAnswer = new StartAnswer(cmd, msg);
+            StartAnswer startAnswer = new StartAnswer(cmd, createLogMessageException(e, cmd));
             if (vmAlreadyExistsInVcenter) {
                 startAnswer.setContextParam("stopRetry", "true");
             }
 
             // Since VM start failed, if there was an existing VM in a different cluster that was unregistered, register it back.

Review comment:
       This line could be removed, a useless comment. The log message itself holds the same content.

##########
File path: plugins/hypervisors/vmware/src/main/java/com/cloud/hypervisor/vmware/resource/VmwareResource.java
##########
@@ -4065,15 +4028,17 @@ protected Answer execute(GetVmDiskStatsCommand cmd) {
                     }
                     diskStats.add(new VmDiskStatsEntry(vmName, VmwareHelper.getDiskDeviceFileName(disk), writeReq, readReq, writeBytes, readBytes));
                 }
-                if (diskStats.size() > 0) {
+                if (CollectionUtils.isNotEmpty(diskStats)) {

Review comment:
       The `CollectionUtils.isNotEpty` is also null safe, good change :+1: 




-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org