diff --git a/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareStorageProcessor.java b/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareStorageProcessor.java index cb7b23adca5..ba2255b0578 100644 --- a/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareStorageProcessor.java +++ b/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareStorageProcessor.java @@ -1367,7 +1367,11 @@ public class VmwareStorageProcessor implements StorageProcessor { hostService.invalidateServiceContext(null); } - String msg = "AttachVolumeCommand failed due to " + VmwareHelper.getExceptionMessage(e); + String msg = ""; + if (isAttach) + msg += "Failed to attach volume: " + e.getMessage(); + else + msg += "Failed to detach volume: " + e.getMessage(); s_logger.error(msg, e); return new AttachAnswer(msg); } diff --git a/server/src/com/cloud/storage/VolumeApiServiceImpl.java b/server/src/com/cloud/storage/VolumeApiServiceImpl.java index 5af0d2d8c20..c1652ed8722 100644 --- a/server/src/com/cloud/storage/VolumeApiServiceImpl.java +++ b/server/src/com/cloud/storage/VolumeApiServiceImpl.java @@ -1378,6 +1378,8 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic throw (ConcurrentOperationException)jobResult; else if (jobResult instanceof InvalidParameterValueException) throw (InvalidParameterValueException)jobResult; + else if (jobResult instanceof RuntimeException) + throw (RuntimeException)jobResult; else if (jobResult instanceof Throwable) throw new RuntimeException("Unexpected exception", (Throwable)jobResult); else if (jobResult instanceof Long) { @@ -1580,6 +1582,8 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic if (jobResult != null) { if (jobResult instanceof ConcurrentOperationException) throw (ConcurrentOperationException)jobResult; + else if (jobResult instanceof RuntimeException) + throw (RuntimeException)jobResult; else if (jobResult instanceof Throwable) throw new RuntimeException("Unexpected exception", (Throwable)jobResult); else if (jobResult instanceof Long) { diff --git a/vmware-base/src/com/cloud/hypervisor/vmware/mo/VirtualMachineMO.java b/vmware-base/src/com/cloud/hypervisor/vmware/mo/VirtualMachineMO.java index 8f05021181c..cd96105a34d 100644 --- a/vmware-base/src/com/cloud/hypervisor/vmware/mo/VirtualMachineMO.java +++ b/vmware-base/src/com/cloud/hypervisor/vmware/mo/VirtualMachineMO.java @@ -1126,6 +1126,14 @@ public class VirtualMachineMO extends BaseMO { throw new Exception("No such disk device: " + vmdkDatastorePath); } + // IDE virtual disk cannot be detached if VM is running + if (deviceInfo.second() != null && deviceInfo.second().contains("ide")) { + if (getPowerState() == VirtualMachinePowerState.POWERED_ON) { + throw new Exception("Removing a virtual disk over IDE controller is not supported while VM is running in VMware hypervisor. " + + "Please re-try when VM is not running."); + } + } + List> chain = getDiskDatastorePathChain(deviceInfo.first(), true); VirtualMachineConfigSpec reConfigSpec = new VirtualMachineConfigSpec();