cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wid...@apache.org
Subject [38/50] [abbrv] git commit: updated refs/heads/statscollector-graphite to 621156c
Date Sun, 28 Sep 2014 09:40:38 GMT
CLOUDSTACK-7495. Volume resize is only supported on kvm, vmware and xenserver. If
the operation is tried on other hypervisors it fails but logs a stack trace. We
should just log a message that the operation isn't supported.


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

Branch: refs/heads/statscollector-graphite
Commit: ec1123aca18009ac91e571e150fcf4c98df5e482
Parents: d19a78d
Author: Devdeep Singh <devdeep@gmail.com>
Authored: Fri Sep 26 13:13:24 2014 +0530
Committer: Devdeep Singh <devdeep@gmail.com>
Committed: Fri Sep 26 13:15:31 2014 +0530

----------------------------------------------------------------------
 .../command/admin/volume/ResizeVolumeCmdByAdmin.java    | 12 ++++++++++--
 .../api/command/user/volume/ResizeVolumeCmd.java        | 11 +++++++++--
 server/src/com/cloud/storage/VolumeApiServiceImpl.java  |  2 +-
 3 files changed, 20 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ec1123ac/api/src/org/apache/cloudstack/api/command/admin/volume/ResizeVolumeCmdByAdmin.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/volume/ResizeVolumeCmdByAdmin.java
b/api/src/org/apache/cloudstack/api/command/admin/volume/ResizeVolumeCmdByAdmin.java
index d1d253c..542fff5 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/volume/ResizeVolumeCmdByAdmin.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/volume/ResizeVolumeCmdByAdmin.java
@@ -24,6 +24,7 @@ import org.apache.cloudstack.api.command.user.volume.ResizeVolumeCmd;
 import org.apache.cloudstack.api.response.VolumeResponse;
 import org.apache.cloudstack.context.CallContext;
 
+import com.cloud.exception.InvalidParameterValueException;
 import com.cloud.exception.ResourceAllocationException;
 import com.cloud.storage.Volume;
 
@@ -33,8 +34,15 @@ public class ResizeVolumeCmdByAdmin extends ResizeVolumeCmd {
 
     @Override
     public void execute() throws ResourceAllocationException{
-        CallContext.current().setEventDetails("Volume Id: " + getEntityId() + " to size "
+ getSize() + "G");
-        Volume volume = _volumeService.resizeVolume(this);
+        Volume volume = null;
+        try {
+            CallContext.current().setEventDetails("Volume Id: " + getEntityId() + " to size
" + getSize() + "G");
+            volume = _volumeService.resizeVolume(this);
+        } catch (InvalidParameterValueException ex) {
+            s_logger.info(ex.getMessage());
+            throw new ServerApiException(ApiErrorCode.UNSUPPORTED_ACTION_ERROR, ex.getMessage());
+        }
+
         if (volume != null) {
             VolumeResponse response = _responseGenerator.createVolumeResponse(ResponseView.Full,
volume);
             //FIXME - have to be moved to ApiResponseHelper

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ec1123ac/api/src/org/apache/cloudstack/api/command/user/volume/ResizeVolumeCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/volume/ResizeVolumeCmd.java b/api/src/org/apache/cloudstack/api/command/user/volume/ResizeVolumeCmd.java
index 49fd6ca..4ec9449 100644
--- a/api/src/org/apache/cloudstack/api/command/user/volume/ResizeVolumeCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/volume/ResizeVolumeCmd.java
@@ -160,8 +160,15 @@ public class ResizeVolumeCmd extends BaseAsyncCmd {
 
     @Override
     public void execute() throws ResourceAllocationException {
-        CallContext.current().setEventDetails("Volume Id: " + getEntityId() + " to size "
+ getSize() + "G");
-        Volume volume = _volumeService.resizeVolume(this);
+        Volume volume = null;
+        try {
+            CallContext.current().setEventDetails("Volume Id: " + getEntityId() + " to size
" + getSize() + "G");
+            volume = _volumeService.resizeVolume(this);
+        } catch (InvalidParameterValueException ex) {
+            s_logger.info(ex.getMessage());
+            throw new ServerApiException(ApiErrorCode.UNSUPPORTED_ACTION_ERROR, ex.getMessage());
+        }
+
         if (volume != null) {
             VolumeResponse response = _responseGenerator.createVolumeResponse(ResponseView.Restricted,
volume);
             //FIXME - have to be moved to ApiResponseHelper

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ec1123ac/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 8ccede7..d89ea4f 100644
--- a/server/src/com/cloud/storage/VolumeApiServiceImpl.java
+++ b/server/src/com/cloud/storage/VolumeApiServiceImpl.java
@@ -720,7 +720,7 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic
 
         if (hypervisorType != HypervisorType.KVM && hypervisorType != HypervisorType.XenServer
&&
                 hypervisorType != HypervisorType.VMware && hypervisorType != HypervisorType.Any
&& hypervisorType != HypervisorType.None) {
-            throw new InvalidParameterValueException("CloudStack currently only supports
volumes marked as the KVM, VMware, or XenServer hypervisor type for resize.");
+            throw new InvalidParameterValueException("CloudStack currently supports volume
resize only on KVM, VMware, or XenServer.");
         }
 
         if (volume.getState() != Volume.State.Ready && volume.getState() != Volume.State.Allocated)
{


Mime
View raw message