Change in vdsm[master]: gluster: add support for arbiter volumes
rnachimu at redhat.com
rnachimu at redhat.com
Thu Jan 21 12:27:09 UTC 2016
Ramesh N has uploaded a new change for review.
Change subject: gluster: add support for arbiter volumes
......................................................................
gluster: add support for arbiter volumes
Add support for arbiter gluster volume creations. Also
include arbiter count and arbiter flag in volume and bricks
details in volume info output.
Change-Id: I05df65879847ed0d03ebccfd2b1eda97073a33e2
Signed-off-by: Ramesh Nachimuthu <rnachimu at redhat.com>
---
M client/vdsClientGluster.py
M lib/api/vdsmapi-gluster-schema.json
M tests/gluster_cli_tests.py
M vdsm/gluster/api.py
M vdsm/gluster/apiwrapper.py
M vdsm/gluster/cli.py
6 files changed, 33 insertions(+), 13 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/59/52559/1
diff --git a/client/vdsClientGluster.py b/client/vdsClientGluster.py
index 89b90ee..181e636 100644
--- a/client/vdsClientGluster.py
+++ b/client/vdsClientGluster.py
@@ -37,10 +37,10 @@
transport = params.get('transport', '')
transportList = transport.strip().split(',') if transport else []
force = (params.get('force', 'no').upper() == 'YES')
-
+ arbiterCount = params.get('arbiter', '')
status = self.s.glusterVolumeCreate(volumeName, brickList,
replicaCount, stripeCount,
- transportList, force)
+ transportList, force, arbiterCount)
pp.pprint(status)
return status['status']['code'], status['status']['message']
@@ -751,7 +751,7 @@
{'glusterVolumeCreate': (
serv.do_glusterVolumeCreate,
('volumeName=<volume_name> bricks=<brick[,brick, ...]> '
- '[replica=<count>] [stripe=<count>] [transport={tcp|rdma}] '
+ '[replica=<count>] [stripe=<count>] [arbiterCount=<count>] [transport={tcp|rdma}] '
'[force={yes|no}]\n\t'
'<volume_name> is name of new volume',
'<brick[,brick, ...]> is brick(s) which will be used to '
diff --git a/lib/api/vdsmapi-gluster-schema.json b/lib/api/vdsmapi-gluster-schema.json
index 233497f..2df4f83 100644
--- a/lib/api/vdsmapi-gluster-schema.json
+++ b/lib/api/vdsmapi-gluster-schema.json
@@ -549,7 +549,7 @@
# Since: 4.14.0
##
{'type': 'BricksInfo',
- 'data': {'name': 'str', 'hostUuid': 'UUID'}}
+ 'data': {'name': 'str', 'hostUuid': 'UUID', 'isArbiter': 'int'}}
##
# @VolumeInfo:
@@ -576,6 +576,8 @@
#
# @redundancyCount: Redundancy count of the volume
#
+# @arbiterCount: Arbiter count of the volume.
+#
# @bricksInfo: details related to bricks(new in version 4.14.0)
#
# Since: 4.10.3
@@ -585,7 +587,7 @@
'transportType': 'transType', 'uuid': 'UUID', 'volumeName': 'str',
'status': 'volumeStatus', 'volumeType': 'str',
'disperseCount': 'int', 'redundancyCount': 'int',
- 'bricksInfo': ['BricksInfo']}}
+ 'arbiterCount': 'int', 'bricksInfo': ['BricksInfo']}}
##
# @StatusOption:
@@ -677,6 +679,8 @@
#
# @force: #optional Force create Volume (new in version 4.14.0)
#
+# @arbiterCount: #optional create arbiter Volume (new in version 4.18.0)
+#
# Returns:
# uuid of the volume
#
@@ -685,7 +689,8 @@
{'command': {'class': 'GlusterVolume', 'name': 'create'},
'data': {'volumeName': 'str', 'bricklist': ['str'],
'*replicaCount': 'int', '*stripeCount': 'int',
- '*transportList': ['transType'], '*force': 'bool'},
+ '*transportList': ['transType'], '*force': 'bool',
+ '*arbiterCount': 'int'},
'returns': 'UUID'}
##
diff --git a/tests/gluster_cli_tests.py b/tests/gluster_cli_tests.py
index 1e601aa..b535b38 100644
--- a/tests/gluster_cli_tests.py
+++ b/tests/gluster_cli_tests.py
@@ -57,15 +57,18 @@
<stripeCount>1</stripeCount>
<replicaCount>2</replicaCount>
<disperseCount>0</disperseCount>
+ <arbiterCount>0</arbiterCount>
<redundancyCount>0</redundancyCount>
<type>2</type>
<typeStr>Replicate</typeStr>
<transport>0</transport>
<bricks>
<brick>192.168.122.2:/tmp/m_b1<name>192.168.122.2:/tmp/m_b1</name>
+ <isArbiter>1</isArbiter>
<hostUuid>04eb591b-2fd3-489e-a22c-5d342a3c713d</hostUuid>
</brick>
<brick>192.168.122.2:/tmp/m_b2<name>192.168.122.2:/tmp/m_b2</name>
+ <isArbiter>1</isArbiter>
<hostUuid>04eb591b-2fd3-489e-a22c-5d342a3c713d</hostUuid>
</brick>
</bricks>
@@ -87,12 +90,14 @@
<stripeCount>1</stripeCount>
<replicaCount>1</replicaCount>
<disperseCount>0</disperseCount>
+ <arbiterCount>1</arbiterCount>
<redundancyCount>0</redundancyCount>
<type>0</type>
<typeStr>Distribute</typeStr>
<transport>1</transport>
<bricks>
<brick>192.168.122.2:/tmp/t_b1<name>192.168.122.2:/tmp/t_b1</name>
+ <isArbiter>1</isArbiter>
<hostUuid>04eb591b-2fd3-489e-a22c-5d342a3c713d</hostUuid>
</brick>
</bricks>
@@ -122,6 +127,7 @@
'stripeCount': '1',
'disperseCount': '0',
'redundancyCount': '0',
+ 'arbiterCount': '0',
'transportType': [gcli.TransportType.TCP],
'uuid': 'b3114c71-741b-4c6f-a39e-80384c4ea3cf',
'volumeName': 'music',
@@ -132,13 +138,15 @@
'distCount': '1',
'bricksInfo': [{
'name': '192.168.122.2:/tmp/t_b1',
- 'hostUuid': '04eb591b-2fd3-489e-a22c-5d342a3c713d'
+ 'hostUuid': '04eb591b-2fd3-489e-a22c-5d342a3c713d',
+ 'isArbiter': '1'
}],
'options': {},
'replicaCount': '1',
'stripeCount': '1',
'disperseCount': '0',
'redundancyCount': '0',
+ 'arbiterCount': '1',
'transportType': [gcli.TransportType.RDMA],
'uuid': 'b444ed94-f346-4cda-bd55-0282f21d22db',
'volumeName': 'test1',
diff --git a/vdsm/gluster/api.py b/vdsm/gluster/api.py
index a604e14..c3ee8c9 100644
--- a/vdsm/gluster/api.py
+++ b/vdsm/gluster/api.py
@@ -300,10 +300,11 @@
@exportAsVerb
def volumeCreate(self, volumeName, brickList, replicaCount=0,
stripeCount=0, transportList=[],
- force=False, options=None):
+ force=False, options=None, arbiterCount=0):
return self.svdsmProxy.glusterVolumeCreate(volumeName, brickList,
replicaCount, stripeCount,
- transportList, force)
+ transportList, force,
+ arbiterCount)
@exportAsVerb
def volumeStart(self, volumeName, force=False, options=None):
diff --git a/vdsm/gluster/apiwrapper.py b/vdsm/gluster/apiwrapper.py
index a018c76..65426ed 100644
--- a/vdsm/gluster/apiwrapper.py
+++ b/vdsm/gluster/apiwrapper.py
@@ -120,9 +120,10 @@
return self._gluster.volumesList(volumeName, remoteServer)
def create(self, volumeName, brickList, replicaCount=0, stripeCount=0,
- transportList=[], force=False):
+ transportList=[], force=False, arbiterCount):
return self._gluster.volumeCreate(volumeName, brickList, replicaCount,
- stripeCount, transportList, force)
+ stripeCount, transportList, force,
+ arbiterCount)
def start(self, volumeName, force=False):
return self._gluster.volumeStart(volumeName, force)
diff --git a/vdsm/gluster/cli.py b/vdsm/gluster/cli.py
index c300fea..8de7ef8 100644
--- a/vdsm/gluster/cli.py
+++ b/vdsm/gluster/cli.py
@@ -372,7 +372,8 @@
'volumeStatus': STATUS,
'volumeType': TYPE,
'disperseCount': DISPERSE_COUNT,
- 'redundancyCount': REDUNDANCY_COUNT}, ...}
+ 'redundancyCount': REDUNDANCY_COUNT,
+ 'arbiterCount': ARBITER_COUNT}, ...}
"""
volumes = {}
for el in tree.findall('volInfo/volumes/volume'):
@@ -391,6 +392,7 @@
value['replicaCount'] = el.find('replicaCount').text
value['disperseCount'] = el.find('disperseCount').text
value['redundancyCount'] = el.find('redundancyCount').text
+ value['arbiterCount'] = el.find('arbiterCount').text
transportType = el.find('transport').text
if transportType == '0':
value['transportType'] = [TransportType.TCP]
@@ -412,6 +414,7 @@
try:
brickDetail['name'] = d.find('name').text
brickDetail['hostUuid'] = d.find('hostUuid').text
+ brickDetail['isArbiter'] = d.find('isArbiter').text
value['bricksInfo'].append(brickDetail)
except AttributeError:
break
@@ -505,12 +508,14 @@
@gluster_mgmt_api
def volumeCreate(volumeName, brickList, replicaCount=0, stripeCount=0,
- transportList=[], force=False):
+ transportList=[], force=False, arbiterCount=0):
command = _getGlusterVolCmd() + ["create", volumeName]
if stripeCount:
command += ["stripe", "%s" % stripeCount]
if replicaCount:
command += ["replica", "%s" % replicaCount]
+ if arbiterCount:
+ command += ["arbiter", "%s" % arbiterCount]
if transportList:
command += ["transport", ','.join(transportList)]
command += brickList
--
To view, visit https://gerrit.ovirt.org/52559
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I05df65879847ed0d03ebccfd2b1eda97073a33e2
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Ramesh N <rnachimu at redhat.com>
More information about the vdsm-patches
mailing list