Aravinda VK has uploaded a new change for review.

Change subject: gluster: Add force option to Volume Create command
......................................................................

gluster: Add force option to Volume Create command

glusterfs cli will fail if system's root partition is used
as brick dirs. If user wants to use system's root partition as
bricks dir then "force" option can be used in gluster cli.

Added the "force" parameter to vdsm verb
glusterVolumeCreate

It will not break backward compatibility since it utilizes
existing optional parameter.

Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1008942
Change-Id: I3b3a6f79c1473c4bc5d7976de20c03e1ac513af0
Signed-off-by: Aravinda VK <[email protected]>
---
M client/vdsClientGluster.py
M vdsm/gluster/api.py
M vdsm/gluster/cli.py
M vdsm/gluster/vdsmapi-gluster-schema.json
4 files changed, 13 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/82/21082/1

diff --git a/client/vdsClientGluster.py b/client/vdsClientGluster.py
index 65e6282..7353e13 100644
--- a/client/vdsClientGluster.py
+++ b/client/vdsClientGluster.py
@@ -39,10 +39,11 @@
         stripeCount = params.get('stripe', '')
         transport = params.get('transport', '')
         transportList = transport.strip().split(',') if transport else []
+        force = {"force": (params.get('force', 'no').upper() == 'YES')}
 
         status = self.s.glusterVolumeCreate(volumeName, brickList,
                                             replicaCount, stripeCount,
-                                            transportList)
+                                            transportList, force)
         return status['status']['code'], status['status']['message']
 
     def do_glusterVolumesList(self, args):
@@ -449,7 +450,8 @@
         {'glusterVolumeCreate': (
             serv.do_glusterVolumeCreate,
             ('volumeName=<volume_name> bricks=<brick[,brick, ...]> '
-             '[replica=<count>] [stripe=<count>] [transport={tcp|rdma}]\n\t'
+             '[replica=<count>] [stripe=<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 '
              'create volume',
diff --git a/vdsm/gluster/api.py b/vdsm/gluster/api.py
index 193d6bd..1078700 100644
--- a/vdsm/gluster/api.py
+++ b/vdsm/gluster/api.py
@@ -78,10 +78,11 @@
 
     @exportAsVerb
     def volumeCreate(self, volumeName, brickList, replicaCount=0,
-                     stripeCount=0, transportList=[], options=None):
+                     stripeCount=0, transportList=[], options={}):
+        force = options.get("force")
         return self.svdsmProxy.glusterVolumeCreate(volumeName, brickList,
                                                    replicaCount, stripeCount,
-                                                   transportList)
+                                                   transportList, force)
 
     @exportAsVerb
     def volumeStart(self, volumeName, force=False, options=None):
diff --git a/vdsm/gluster/cli.py b/vdsm/gluster/cli.py
index a654b56..25fd8ba 100644
--- a/vdsm/gluster/cli.py
+++ b/vdsm/gluster/cli.py
@@ -445,7 +445,7 @@
 
 @makePublic
 def volumeCreate(volumeName, brickList, replicaCount=0, stripeCount=0,
-                 transportList=[]):
+                 transportList=[], force=False):
     command = _getGlusterVolCmd() + ["create", volumeName]
     if stripeCount:
         command += ["stripe", "%s" % stripeCount]
@@ -454,6 +454,10 @@
     if transportList:
         command += ["transport", ','.join(transportList)]
     command += brickList
+
+    if force:
+        command.append('force')
+
     try:
         xmltree = _execGlusterXml(command)
     except ge.GlusterCmdFailedException as e:
diff --git a/vdsm/gluster/vdsmapi-gluster-schema.json 
b/vdsm/gluster/vdsmapi-gluster-schema.json
index 7de762a..3bab622 100644
--- a/vdsm/gluster/vdsmapi-gluster-schema.json
+++ b/vdsm/gluster/vdsmapi-gluster-schema.json
@@ -558,7 +558,7 @@
 # Since: 4.10.3
 ##
 {'command': {'class': 'GlusterVolume', 'name': 'create'},
- 'data': {'volumeName': 'str', 'bricklist': ['str'], 'replicaCount': 'int', 
'stripeCount': 'int', 'transportList': ['transType']},
+ 'data': {'volumeName': 'str', 'bricklist': ['str'], 'replicaCount': 'int', 
'stripeCount': 'int', 'transportList': ['transType'], 'force': 'bool'},
  'returns': 'UUID'}
 
 ##


-- 
To view, visit http://gerrit.ovirt.org/21082
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3b3a6f79c1473c4bc5d7976de20c03e1ac513af0
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Aravinda VK <[email protected]>
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to