summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShwetha-H-Panduranga <shwetha@gluster.com>2011-12-13 17:07:12 +0530
committerShwetha-H-Panduranga <shwetha@gluster.com>2011-12-13 17:07:12 +0530
commit57991580217d955984c68cd899d9031736182be0 (patch)
tree89a2150f003685789d12a77ed90033924d549415
parent689f862f24f949361603a808250ae3f7ec9f40f6 (diff)
Changes made to volume info. This is to support multiple 'volumetypes' and counts
-rw-r--r--TestUnits/xlators/cluster/afr/self_heal/testenv.cfg8
-rwxr-xr-xlibs/globals/testenv.py10
-rw-r--r--libs/parser/parser.py27
-rw-r--r--libs/utils/glusterutils.py16
4 files changed, 41 insertions, 20 deletions
diff --git a/TestUnits/xlators/cluster/afr/self_heal/testenv.cfg b/TestUnits/xlators/cluster/afr/self_heal/testenv.cfg
index 290f50f..991756f 100644
--- a/TestUnits/xlators/cluster/afr/self_heal/testenv.cfg
+++ b/TestUnits/xlators/cluster/afr/self_heal/testenv.cfg
@@ -49,11 +49,13 @@ hostname = server2.hostname
path = /opt/export1
# Volume Section
-# Necessary Options: volumename, volumetype, count, transporttype, bricks
+# Necessary Options: volumename, bricks
+# Optional replica=<Count>, stripe=<Count>
+#
[volume1]
volumename = replicate
-volumetype = replica
-count = 2
+replica=
+stripe=
transporttype = tcp
bricks = brick1, brick2
diff --git a/libs/globals/testenv.py b/libs/globals/testenv.py
index 0720c2c..a73858b 100755
--- a/libs/globals/testenv.py
+++ b/libs/globals/testenv.py
@@ -33,7 +33,7 @@ class TestEnv():
['hostname', 'path'])
self._volume_tuple = namedtuple('Volume',
- ['volumename', 'volumetype', 'count',
+ ['volumename','replica', 'stripe',
'transporttype', 'bricks'])
self._client_tuple = namedtuple('Client',
@@ -255,13 +255,13 @@ class TestEnv():
else:
return 1
- def addVolume(self, key, volumename, volumetype, count,
- transporttype, bricks):
+ def addVolume(self, key, volumename, replica,
+ stripe, transporttype, bricks):
"""
"""
brickskeylist = [x.strip() for x in bricks.split(",")]
- volume_obj = self._volume_tuple(volumename, volumetype,
- count, transporttype, brickskeylist)
+ volume_obj = self._volume_tuple(volumename, replica, stripe,
+ transporttype, brickskeylist)
self._volumes[key] = volume_obj
def getVolume(self, volumekey):
diff --git a/libs/parser/parser.py b/libs/parser/parser.py
index 70619c9..51c960d 100644
--- a/libs/parser/parser.py
+++ b/libs/parser/parser.py
@@ -233,17 +233,28 @@ def parse_testenv_configfile(filename):
return 1
elif re.match('volume', result):
- necessary_options = ["volumename", "volumetype",
- "count", "transporttype",
- "bricks"]
+ necessary_options = ["volumename", "bricks"]
if verify_necessary_options(cp, section, necessary_options):
volumename = items.pop('volumename')
- volumetype = items.pop('volumetype')
- count = items.pop('count')
- transporttype = items.pop('transporttype')
bricks = items.pop('bricks')
- function(section, volumename, volumetype,
- count, transporttype, bricks)
+ if (items.has_key('replica') and items['replica']):
+ replica = items.pop('replica')
+ else:
+ replica = None
+
+ if (items.has_key('stripe') and items['stripe']):
+ stripe = items.pop('stripe')
+ else:
+ stripe = None
+
+ if (items.has_key('transporttype') and
+ items['transporttype']):
+ transporttype = items.pop('transporttype')
+ else:
+ transporttype = None
+
+ function(section, volumename, replica,
+ stripe, transporttype, bricks)
else:
return 1
diff --git a/libs/utils/glusterutils.py b/libs/utils/glusterutils.py
index 7ab41d0..551d23e 100644
--- a/libs/utils/glusterutils.py
+++ b/libs/utils/glusterutils.py
@@ -277,18 +277,26 @@ def volume_create(serverkey):
"""
"""
logger = GlobalObj.getLoggerObj()
- base_command = "gluster volume create "
+ base_command = "gluster volume create"
+ command = [base_command]
env = GlobalObj.getTestenvObj()
cm = GlobalObj.getConnectionsManagerObj()
active_volume = env.getActiveVolume()
if not active_volume:
logger.error("ActiveVolume not defined for the TestEnvironment")
return 1
+ command.extend([active_volume.volumename])
+
+ if active_volume.replica:
+ command.extend(["replica", active_volume.replica])
- command = ' '.join([base_command, active_volume.volumename,
- active_volume.volumetype, active_volume.count,
- "transport", active_volume.transporttype])
+ if active_volume.stripe:
+ command.extend(["stripe", active_volume.stripe])
+
+ if active_volume.transporttype:
+ command.extend(["transport", active_volume.transporttype])
+ command = ' '.join(command)
for brick_obj in active_volume.bricks:
brick_value = brick_obj.hostname + ":" + brick_obj.path
command = ' '.join([command, brick_value])