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/11/02 08:22:01 UTC

[GitHub] [cloudstack] sureshanaparti commented on a change in pull request #5650: Remove restriction, in VMWare, to resize only SCSI disks

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



##########
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:
       @SadiJr Alternatively, you can check for specific controller types from _com.cloud.hypervisor.vmware.mo.ScsiDiskControllerType_ (or) _com.cloud.hypervisor.vmware.mo.DiskControllerType_




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