SadiJr commented on a change in pull request #5650:
URL: https://github.com/apache/cloudstack/pull/5650#discussion_r741856582



##########
File path: 
plugins/hypervisors/vmware/src/main/java/com/cloud/hypervisor/vmware/resource/VmwareResource.java
##########
@@ -928,34 +926,33 @@ private Answer execute(ResizeVolumeCommand cmd) {
                     vmMo.destroy();
                 }
             } catch (Throwable e) {
-                s_logger.info("Failed to destroy worker VM: " + vmName);
+                s_logger.error(String.format("Failed to destroy worker VM 
[name: %s] due to: [%s].", vmName, e.getMessage()), e);
             }
         }
     }
 
     private VirtualDisk getDiskAfterResizeDiskValidations(VirtualMachineMO 
vmMo, String volumePath) throws Exception {
         Pair<VirtualDisk, String> vdisk = vmMo.getDiskDevice(volumePath);
         if (vdisk == null) {
-            if (s_logger.isTraceEnabled()) {
-                s_logger.trace("resize volume done (failed)");
-            }
-            throw new Exception("No such disk device: " + volumePath);
+            String errorMsg = String.format("Resize volume of VM [name: %s] 
failed because disk device [path: %s] doesn't exist.", vmMo.getVmName(), 
volumePath);
+            s_logger.error(errorMsg);
+            throw new Exception(errorMsg);
         }
 
         // IDE virtual disk cannot be re-sized if VM is running
         if (vdisk.second() != null && vdisk.second().contains("ide")) {
-            throw new Exception("Re-sizing a virtual disk over an IDE 
controller is not supported in the VMware hypervisor. " +
-                    "Please re-try when virtual disk is attached to a VM using 
a SCSI controller.");
+            String errorMsg = String.format("Re-sizing a virtual disk over an 
IDE controller is not supported in the VMware hypervisor. "
+                    + "Please re-try when virtual disk is attached to VM 
[name: %s] using a SCSI controller.", vmMo.getVmName());
+            s_logger.error(errorMsg);
+            throw new Exception(errorMsg);
         }
 
-        if (vdisk.second() != null && 
!vdisk.second().toLowerCase().startsWith("scsi")) {

Review comment:
       @harikrishna-patnala The IDE controller check is done on the top line 
(https://github.com/apache/cloudstack/blob/4ad6c8e3cdee2ba4672f5c308223d3e15caeeed6/plugins/hypervisors/vmware/src/main/java/com/cloud/hypervisor/vmware/resource/VmwareResource.java#L943),
 so I see no reason to redo it here. @sureshanaparti  is an option, however, if 
in the future new types of SCSI controllers are added, this code would have to 
be revised to accommodate the changes. Rather than checking for allowed 
controllers, it is much more practical to check for disallowed controllers.




-- 
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: [email protected]

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


Reply via email to