cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bhais...@apache.org
Subject [12/20] git commit: updated refs/heads/4.5 to 64e938b
Date Mon, 02 Feb 2015 10:17:10 GMT
CLOUDSTACK-8119. Propagate error message to UI for attach/detach volume failure operations.
For AttachVolume/DetachVolume API command, improve user error message in case of RuntimeException
by throwing the exception instead of 'Unexpected Exception'.

(cherry picked from commit 4d7ede535df568c6aab4a228ac794ec11d433e1e)
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>

Conflicts:
	server/src/com/cloud/storage/VolumeApiServiceImpl.java


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/272f282a
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/272f282a
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/272f282a

Branch: refs/heads/4.5
Commit: 272f282a056c532adefc3fef6076e6337a6a7179
Parents: b9932a0
Author: Likitha Shetty <likitha.shetty@citrix.com>
Authored: Tue Dec 2 16:50:20 2014 +0530
Committer: Rohit Yadav <rohit.yadav@shapeblue.com>
Committed: Mon Feb 2 13:57:38 2015 +0530

----------------------------------------------------------------------
 .../com/cloud/storage/resource/VmwareStorageProcessor.java   | 6 +++++-
 server/src/com/cloud/storage/VolumeApiServiceImpl.java       | 6 ++++++
 .../src/com/cloud/hypervisor/vmware/mo/VirtualMachineMO.java | 8 ++++++++
 3 files changed, 19 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/272f282a/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareStorageProcessor.java
----------------------------------------------------------------------
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 621f005..620d5fa 100644
--- a/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareStorageProcessor.java
+++ b/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareStorageProcessor.java
@@ -1357,7 +1357,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);
         }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/272f282a/server/src/com/cloud/storage/VolumeApiServiceImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/VolumeApiServiceImpl.java b/server/src/com/cloud/storage/VolumeApiServiceImpl.java
index 6d74fa4..fe46b1c 100644
--- a/server/src/com/cloud/storage/VolumeApiServiceImpl.java
+++ b/server/src/com/cloud/storage/VolumeApiServiceImpl.java
@@ -1387,6 +1387,10 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic
             if (jobResult != null) {
                 if (jobResult instanceof ConcurrentOperationException)
                     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) {
@@ -1590,6 +1594,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) {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/272f282a/vmware-base/src/com/cloud/hypervisor/vmware/mo/VirtualMachineMO.java
----------------------------------------------------------------------
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 4517ad4..f892477 100644
--- a/vmware-base/src/com/cloud/hypervisor/vmware/mo/VirtualMachineMO.java
+++ b/vmware-base/src/com/cloud/hypervisor/vmware/mo/VirtualMachineMO.java
@@ -1164,6 +1164,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<Pair<String, ManagedObjectReference>> chain = getDiskDatastorePathChain(deviceInfo.first(),
true);
 
         VirtualMachineConfigSpec reConfigSpec = new VirtualMachineConfigSpec();


Mime
View raw message