cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From likit...@apache.org
Subject git commit: updated refs/heads/master to f803100
Date Fri, 01 Aug 2014 11:26:04 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/master fca41bf52 -> f80310081


CLOUDSTACK-6969. Data Volume Shrink operation failing with "Unexpected Exception".
For ResizeVolume API command -
1. If hypervisor resource throws an exception, handle the NPE thrown by the job framework.
2. Improve user error message in case of RuntimeException by throwing the exception instead
of 'Unexpected Exception'.


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

Branch: refs/heads/master
Commit: f8031008139978abb6831a1d7cb240c993fbf8f5
Parents: fca41bf
Author: Likitha Shetty <likitha.shetty@citrix.com>
Authored: Fri Aug 1 15:49:42 2014 +0530
Committer: Likitha Shetty <likitha.shetty@citrix.com>
Committed: Fri Aug 1 16:23:47 2014 +0530

----------------------------------------------------------------------
 .../kvm/resource/LibvirtComputingResource.java       |  2 +-
 .../hypervisor/vmware/resource/VmwareResource.java   |  5 +++--
 .../src/com/cloud/storage/VolumeApiServiceImpl.java  | 15 +++++++++------
 3 files changed, 13 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f8031008/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
index f84af6b..f6fe75c 100755
--- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
+++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
@@ -1899,7 +1899,7 @@ public class LibvirtComputingResource extends ServerResourceBase implements
Serv
             s_logger.debug("after resize, size reports as " + finalSize + ", requested "
+ newSize);
             return new ResizeVolumeAnswer(cmd, true, "success", finalSize);
         } catch (CloudRuntimeException e) {
-            String error = "failed to resize volume: " + e;
+            String error = "Failed to resize volume: " + e.getMessage();
             s_logger.debug(error);
             return new ResizeVolumeAnswer(cmd, false, error);
         }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f8031008/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
index c6258a2..8a2488d 100755
--- a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
+++ b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
@@ -564,7 +564,8 @@ public class VmwareResource implements StoragePoolResource, ServerResource,
Vmwa
             VirtualDisk disk = vdisk.first();
             long oldSize = disk.getCapacityInKB();
             if (newSize < oldSize) {
-                throw new Exception("VMware doesn't support shrinking volume from larger
size: " + oldSize + " MB to a smaller size: " + newSize + " MB");
+                throw new Exception("VMware doesn't support shrinking volume from larger
size: " + oldSize/(1024*1024) + " GB to a smaller size: "
+                        + newSize/(1024*1024) + " GB");
             } else if (newSize == oldSize) {
                 return new ResizeVolumeAnswer(cmd, true, "success", newSize * 1024);
             }
@@ -582,7 +583,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource,
Vmwa
             return new ResizeVolumeAnswer(cmd, true, "success", newSize * 1024);
         } catch (Exception e) {
             s_logger.error("Unable to resize volume", e);
-            String error = "failed to resize volume:" + e;
+            String error = "Failed to resize volume: " + e.getMessage();
             return new ResizeVolumeAnswer(cmd, false, error);
         }
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f8031008/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 7ec4798..5a83ac9 100644
--- a/server/src/com/cloud/storage/VolumeApiServiceImpl.java
+++ b/server/src/com/cloud/storage/VolumeApiServiceImpl.java
@@ -925,6 +925,9 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic
                     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);
                     }
@@ -1000,7 +1003,11 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic
             VolumeApiResult result = future.get();
             if (result.isFailed()) {
                 s_logger.warn("Failed to resize the volume " + volume);
-                return null;
+                String details = "";
+                if (result.getResult() != null && !result.getResult().isEmpty())
{
+                    details = result.getResult();
+                }
+                throw new CloudRuntimeException(details);
             }
 
             volume = _volsDao.findById(volume.getId());
@@ -1029,16 +1036,12 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic
             } else {
                 _resourceLimitMgr.decrementResourceCount(volume.getAccountId(), ResourceType.primary_storage,
volume.isDisplayVolume(), new Long(currentSize - newSize));
             }
-            return volume;
         } catch (InterruptedException e) {
             s_logger.warn("failed get resize volume result", e);
         } catch (ExecutionException e) {
             s_logger.warn("failed get resize volume result", e);
-        } catch (Exception e) {
-            s_logger.warn("failed get resize volume result", e);
         }
-
-        return null;
+        return volume;
     }
 
     @Override


Mime
View raw message