summaryrefslogtreecommitdiffstats
path: root/src/com.gluster.storage.management.gateway
diff options
context:
space:
mode:
authorSelvasundaram <selvam@gluster.com>2011-08-09 22:41:18 +0530
committerSelvasundaram <selvam@gluster.com>2011-08-09 22:43:20 +0530
commitb4146b5746121c3cfeb55a1fbccaebec82c52eb3 (patch)
tree6ca397c5219f354c11f0c86f9ba9808c41a7f653 /src/com.gluster.storage.management.gateway
parente878e1aecb3fd21615102e3806390efa8277851c (diff)
Demo feedback changes on volumes
Diffstat (limited to 'src/com.gluster.storage.management.gateway')
-rw-r--r--src/com.gluster.storage.management.gateway/src/com/gluster/storage/management/gateway/resources/v1_0/VolumesResource.java5
-rw-r--r--src/com.gluster.storage.management.gateway/src/com/gluster/storage/management/gateway/services/VolumeService.java2
-rw-r--r--src/com.gluster.storage.management.gateway/src/com/gluster/storage/management/gateway/utils/GlusterUtil.java35
3 files changed, 27 insertions, 15 deletions
diff --git a/src/com.gluster.storage.management.gateway/src/com/gluster/storage/management/gateway/resources/v1_0/VolumesResource.java b/src/com.gluster.storage.management.gateway/src/com/gluster/storage/management/gateway/resources/v1_0/VolumesResource.java
index 89e7eaf1..74275955 100644
--- a/src/com.gluster.storage.management.gateway/src/com/gluster/storage/management/gateway/resources/v1_0/VolumesResource.java
+++ b/src/com.gluster.storage.management.gateway/src/com/gluster/storage/management/gateway/resources/v1_0/VolumesResource.java
@@ -212,11 +212,8 @@ public class VolumesResource extends AbstractResource {
if (enableCifs) {
volumeService.modifyCIFSUsers(clusterName, volumeName, cifsUsers);
} else {
+ volumeService.stopCifsReExport(clusterName, volumeName);
volumeService.deleteCifsUsers(clusterName, volumeName);
- //TODO: workaround - If samba service are not stopped by "deleteCifsUsers" script,
- // gateway needs to stop the services
- // modifyCIFSUsers(clusterName, volumeName, "");
- // stopCifsReExport(clusterName, volumeName);
}
} else {
volumeService.performVolumeOperation(clusterName, volumeName, operation);
diff --git a/src/com.gluster.storage.management.gateway/src/com/gluster/storage/management/gateway/services/VolumeService.java b/src/com.gluster.storage.management.gateway/src/com/gluster/storage/management/gateway/services/VolumeService.java
index 0005a5a9..0bd1b4ce 100644
--- a/src/com.gluster.storage.management.gateway/src/com/gluster/storage/management/gateway/services/VolumeService.java
+++ b/src/com.gluster.storage.management.gateway/src/com/gluster/storage/management/gateway/services/VolumeService.java
@@ -333,7 +333,7 @@ public class VolumeService {
throw new GlusterValidationException("Cluster [" + clusterName + "] not found!");
}
- if (volumeType.equals(VOLUME_TYPE.DISTRIBUTED_MIRROR) && replicaCount <= 0) {
+ if (volumeType.equals(VOLUME_TYPE.DISTRIBUTED_REPLICATE) && replicaCount <= 0) {
throw new GlusterValidationException("Replica count must be a positive integer");
}
diff --git a/src/com.gluster.storage.management.gateway/src/com/gluster/storage/management/gateway/utils/GlusterUtil.java b/src/com.gluster.storage.management.gateway/src/com/gluster/storage/management/gateway/utils/GlusterUtil.java
index db4bd4bd..ccb1054a 100644
--- a/src/com.gluster.storage.management.gateway/src/com/gluster/storage/management/gateway/utils/GlusterUtil.java
+++ b/src/com.gluster.storage.management.gateway/src/com/gluster/storage/management/gateway/utils/GlusterUtil.java
@@ -69,6 +69,10 @@ public class GlusterUtil {
private static final String VOLUME_LOG_LOCATION_PFX = "log file location:";
private static final String VOLUME_TYPE_DISTRIBUTE = "Distribute";
private static final String VOLUME_TYPE_REPLICATE = "Replicate";
+ private static final String VOLUME_TYPE_DISTRIBUTED_REPLICATTE = "Distributed-Replicate";
+ private static final String VOLUME_TYPE_STRIPE = "Stripe";
+ private static final String VOLUME_TYPE_DISTRIBUTED_STRIPE = "Distributed-Stripe";
+
private static final String GLUSTERD_INFO_FILE = "/etc/glusterd/glusterd.info";
private static final GlusterCoreUtil glusterCoreUtil = new GlusterCoreUtil();
@@ -251,15 +255,15 @@ public class GlusterUtil {
public void createVolume(String knownServer, String volumeName, String volumeTypeStr, String transportTypeStr,
Integer replicaCount, Integer stripeCount, String bricks, String accessProtocols, String options) {
-
+
int count = 1; // replica or stripe count
VOLUME_TYPE volType = Volume.getVolumeTypeByStr(volumeTypeStr);
String volTypeArg = null;
- if (volType == VOLUME_TYPE.DISTRIBUTED_MIRROR) {
+ if (volType == VOLUME_TYPE.REPLICATE || volType == VOLUME_TYPE.DISTRIBUTED_REPLICATE) {
volTypeArg = "replica";
count = replicaCount;
- } else if (volType == VOLUME_TYPE.DISTRIBUTED_STRIPE) {
+ } else if (volType == VOLUME_TYPE.STRIPE || volType == VOLUME_TYPE.DISTRIBUTED_STRIPE) {
volTypeArg = "stripe";
count = stripeCount;
}
@@ -357,13 +361,23 @@ public class GlusterUtil {
String volumeType = extractToken(line, VOLUME_TYPE_PFX);
if (volumeType != null) {
if (volumeType.equals(VOLUME_TYPE_DISTRIBUTE)) {
- volume.setVolumeType(VOLUME_TYPE.PLAIN_DISTRIBUTE);
+ volume.setVolumeType(VOLUME_TYPE.DISTRIBUTE);
+
} else if (volumeType.equals(VOLUME_TYPE_REPLICATE)) {
- volume.setVolumeType(VOLUME_TYPE.DISTRIBUTED_MIRROR);
+ volume.setVolumeType(VOLUME_TYPE.REPLICATE);
volume.setReplicaCount(Volume.DEFAULT_REPLICA_COUNT);
- } else {
+
+ } else if ( volumeType.equals(VOLUME_TYPE_DISTRIBUTED_REPLICATTE) ){
+ volume.setVolumeType(VOLUME_TYPE.DISTRIBUTED_REPLICATE);
+ volume.setReplicaCount(Volume.DEFAULT_REPLICA_COUNT);
+
+ } else if ( volumeType.equals(VOLUME_TYPE_STRIPE) ){
+ volume.setVolumeType(VOLUME_TYPE.STRIPE);
+ volume.setReplicaCount(Volume.DEFAULT_REPLICA_COUNT);
+
+ } else if ( volumeType.equals(VOLUME_TYPE_DISTRIBUTED_STRIPE) ){
volume.setVolumeType(VOLUME_TYPE.DISTRIBUTED_STRIPE);
- volume.setStripeCount(Volume.DEFAULT_STRIPE_COUNT);
+ volume.setReplicaCount(Volume.DEFAULT_STRIPE_COUNT);
}
return true;
}
@@ -374,13 +388,14 @@ public class GlusterUtil {
if (extractToken(line, "x") != null) {
// expected formated of line is "Number of Bricks: 3 x 2 = 6"
int count = Integer.parseInt(line.split("x")[1].split("=")[0].trim());
- if (volume.getVolumeType() == VOLUME_TYPE.DISTRIBUTED_STRIPE) {
+ if (volume.getVolumeType() == VOLUME_TYPE.STRIPE
+ || volume.getVolumeType() == VOLUME_TYPE.DISTRIBUTED_STRIPE) {
volume.setStripeCount(count);
- } else if (volume.getVolumeType() == VOLUME_TYPE.DISTRIBUTED_MIRROR) {
+ } else if (volume.getVolumeType() == VOLUME_TYPE.REPLICATE
+ || volume.getVolumeType() == VOLUME_TYPE.DISTRIBUTED_REPLICATE) {
volume.setReplicaCount(count);
volume.setStripeCount(0);
}
-
}
return;
}