summaryrefslogtreecommitdiffstats
path: root/src/com.gluster.storage.management.server
diff options
context:
space:
mode:
authorShireesh Anjal <shireesh@gluster.com>2011-07-01 16:15:23 +0530
committerShireesh Anjal <shireesh@gluster.com>2011-07-01 16:15:23 +0530
commit2c4ea3418784160bdf4f186b2488e974465161e7 (patch)
treedcbf4de394194c86f3d5df499fcb99b63dc35c5e /src/com.gluster.storage.management.server
parent40d4024c47ca1e1e15e2500a5412791d364bd8b0 (diff)
[Bug 3117] New: Failing to create volume should throw error message instead of stack trace.
Diffstat (limited to 'src/com.gluster.storage.management.server')
-rw-r--r--src/com.gluster.storage.management.server/src/com/gluster/storage/management/server/resources/VolumesResource.java25
1 files changed, 15 insertions, 10 deletions
diff --git a/src/com.gluster.storage.management.server/src/com/gluster/storage/management/server/resources/VolumesResource.java b/src/com.gluster.storage.management.server/src/com/gluster/storage/management/server/resources/VolumesResource.java
index c9ae0fe5..d568d519 100644
--- a/src/com.gluster.storage.management.server/src/com/gluster/storage/management/server/resources/VolumesResource.java
+++ b/src/com.gluster.storage.management.server/src/com/gluster/storage/management/server/resources/VolumesResource.java
@@ -207,27 +207,32 @@ public class VolumesResource extends AbstractResource {
return badRequestResponse("Stripe count must be a positive integer");
}
+ try {
+ createVolume(clusterName, volumeName, volumeType, transportType, replicaCount, stripeCount, bricks, accessProtocols,
+ options);
+ return createdResponse(volumeName);
+ } catch (Exception e) {
+ return errorResponse(e.getMessage());
+ }
+ }
+
+ public void performCreateVolume(String clusterName, String volumeName, String volumeType, String transportType, Integer replicaCount,
+ Integer stripeCount, String bricks, String accessProtocols, String options) {
GlusterServer onlineServer = clusterService.getOnlineServer(clusterName);
if (onlineServer == null) {
- return errorResponse("No online servers found in cluster [" + clusterName + "]");
+ throw new GlusterRuntimeException("No online servers found in cluster [" + clusterName + "]");
}
- try {
+ try {
glusterUtil.createVolume(onlineServer.getName(), volumeName, volumeType, transportType, replicaCount, stripeCount, bricks, accessProtocols, options);
- return createdResponse(volumeName);
} catch (ConnectionException e) {
// online server has gone offline! try with a different one.
onlineServer = clusterService.getNewOnlineServer(clusterName);
if (onlineServer == null) {
- return errorResponse("No online servers found in cluster [" + clusterName + "]");
+ throw new GlusterRuntimeException("No online servers found in cluster [" + clusterName + "]");
}
- try {
- glusterUtil.createVolume(onlineServer.getName(), volumeName, volumeType, transportType, replicaCount, stripeCount, bricks, accessProtocols, options);
- return createdResponse(volumeName);
- } catch(Exception e1) {
- return errorResponse(e1.getMessage());
- }
+ glusterUtil.createVolume(onlineServer.getName(), volumeName, volumeType, transportType, replicaCount, stripeCount, bricks, accessProtocols, options);
}
}