Change in vdsm[ovirt-3.5-gluster]: gluster: Added VDSM verb to stop gluster related processes

rnachimu at redhat.com rnachimu at redhat.com
Wed Nov 11 15:38:05 UTC 2015


Hello Piotr Kliczewski, Bala.FA, Dan Kenigsberg,

I'd like you to do a code review.  Please visit

    https://gerrit.ovirt.org/48449

to review the following change.

Change subject: gluster: Added VDSM verb to stop gluster related processes
......................................................................

gluster: Added VDSM verb to stop gluster related processes

Added a verb which stops the gluster related process like
brick processes, gsyncd process.
This needs to be done as part of a host moving to maintenance
mode. as data should not be available if a host is moved to
maintenence mode for some migration etc.

Change-Id: Id686e098b323eededcf1f89de331a1d524274995
Bug-URL: https://bugzilla.redhat.com/1205724
Signed-off-by: Shubhendu Tripathi <shtripat at redhat.com>
Reviewed-on: https://gerrit.ovirt.org/43821
Tested-by: Ramesh N <rnachimu at redhat.com>
Continuous-Integration: Jenkins CI
Reviewed-by: Bala.FA <barumuga at redhat.com>
Reviewed-by: Piotr Kliczewski <piotr.kliczewski at gmail.com>
Reviewed-by: Dan Kenigsberg <danken at redhat.com>
---
M client/vdsClientGluster.py
M vdsm/gluster/api.py
M vdsm/gluster/apiwrapper.py
M vdsm/gluster/exception.py
M vdsm/rpc/vdsmapi-gluster-schema.json
5 files changed, 45 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/49/48449/1

diff --git a/client/vdsClientGluster.py b/client/vdsClientGluster.py
index a4bce63..89b90ee 100644
--- a/client/vdsClientGluster.py
+++ b/client/vdsClientGluster.py
@@ -740,6 +740,11 @@
         pp.pprint(status)
         return status['status']['code'], status['status']['message']
 
+    def do_glusterProcessesStop(self, args):
+        status = self.s.glusterProcessesStop()
+        pp.pprint(status)
+        return status['status']['code'], status['status']['message']
+
 
 def getGlusterCmdDict(serv):
     return \
@@ -1252,5 +1257,10 @@
              serv.do_glusterSnapshotScheduleReset,
              ('',
               'Reset gluster snapshot scheduling'
+              )),
+         'glusterProcessesStop': (
+             serv.do_glusterProcessesStop,
+             ('',
+              'Stop gluster processes'
               ))
          }
diff --git a/vdsm/gluster/api.py b/vdsm/gluster/api.py
index 0c5829f..90a96ef 100644
--- a/vdsm/gluster/api.py
+++ b/vdsm/gluster/api.py
@@ -52,6 +52,12 @@
     "/usr/sbin/snap_scheduler.py",
 )
 
+_stopAllProcessesPath = utils.CommandPath(
+    "stop-all-gluster-processes.sh",
+    "/usr/share/glusterfs/scripts/stop-all-gluster-processes.sh",
+)
+
+
 GLUSTER_RPM_PACKAGES = (
     ('glusterfs', ('glusterfs',)),
     ('glusterfs-fuse', ('glusterfs-fuse',)),
@@ -263,6 +269,14 @@
         raise ge.GlusterSnapshotScheduleFlagUpdateFailedException(
             err=[str(e)])
     return True
+
+
+ at makePublic
+def processesStop():
+    command = ["/bin/sh", _stopAllProcessesPath.cmd]
+    rc, out, err = utils.execCmd(command)
+    if rc:
+        raise ge.GlusterProcessesStopFailedException(rc)
 
 
 class GlusterApi(object):
@@ -752,6 +766,10 @@
     def snapshotScheduleReset(self, options=None):
         self.svdsmProxy.glusterSnapshotScheduleFlagUpdate("none")
 
+    @exportAsVerb
+    def processesStop(self):
+        self.svdsmProxy.glusterProcessesStop()
+
 
 def getGlusterMethods(gluster):
     l = []
diff --git a/vdsm/gluster/apiwrapper.py b/vdsm/gluster/apiwrapper.py
index 4768a86..a018c76 100644
--- a/vdsm/gluster/apiwrapper.py
+++ b/vdsm/gluster/apiwrapper.py
@@ -86,6 +86,9 @@
         return self._gluster.createBrick(name, mountPoint,
                                          devList, fsType, raidParams)
 
+    def processesStop(self):
+        return self._gluster.processesStop()
+
 
 class GlusterService(GlusterApiBase):
     def __init__(self):
diff --git a/vdsm/gluster/exception.py b/vdsm/gluster/exception.py
index 3749e14..a0e36ce 100644
--- a/vdsm/gluster/exception.py
+++ b/vdsm/gluster/exception.py
@@ -103,6 +103,11 @@
     message = "Command failed"
 
 
+class GlusterProcessesStopFailedException(GlusterGeneralException):
+    code = 4579
+    message = "Failed to stop gluster processes"
+
+
 # Volume
 class GlusterVolumeException(GlusterException):
     code = 4111
diff --git a/vdsm/rpc/vdsmapi-gluster-schema.json b/vdsm/rpc/vdsmapi-gluster-schema.json
index d83344c..ce4cba8 100644
--- a/vdsm/rpc/vdsmapi-gluster-schema.json
+++ b/vdsm/rpc/vdsmapi-gluster-schema.json
@@ -1296,6 +1296,15 @@
  'returns': 'bool'}
 
 ##
+# @GlusterHost.processesStop:
+#
+# Stops the gluster processes on the host
+#
+# Since: 4.17.0
+##
+{'command': {'class': 'GlusterHost', 'name': 'processesStop'}}
+
+##
 # @GlusterVolumeStatsInfo:
 #
 # Gluster Volumes disk usage statistics


-- 
To view, visit https://gerrit.ovirt.org/48449
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id686e098b323eededcf1f89de331a1d524274995
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.5-gluster
Gerrit-Owner: Ramesh N <rnachimu at redhat.com>
Gerrit-Reviewer: Bala.FA <barumuga at redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken at redhat.com>
Gerrit-Reviewer: Piotr Kliczewski <piotr.kliczewski at gmail.com>


More information about the vdsm-patches mailing list