Change in vdsm[master]: gluster: Added VDSM verb to stop gluster related processes

shtripat at redhat.com shtripat at redhat.com
Mon Jul 20 05:07:31 UTC 2015


Shubhendu Tripathi has uploaded a new change for review.

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>
---
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, 51 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/21/43821/1

diff --git a/client/vdsClientGluster.py b/client/vdsClientGluster.py
index a4bce63..a72d4e3 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_glusterStopProcesses(self, args):
+        status = self.s.glusterStopProcesses()
+        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'
+              )),
+         'glusterStopProcesses' : (
+             serv.do_glusterStopProcesses,
+             ('',
+              'Stop gluster processes'
               ))
          }
diff --git a/vdsm/gluster/api.py b/vdsm/gluster/api.py
index 781ab77..3467412 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',)),
@@ -262,6 +268,15 @@
     except (IOError, OSError) as e:
         raise ge.GlusterSnapshotScheduleFlagUpdateFailedException(
             err=[str(e)])
+    return True
+
+
+ at makePublic
+def stopProcesses():
+    command = ["/bin/sh", _stopAllProcessesPath.cmd]
+    rc, out, err = utils.execCmd(command)
+    if rc:
+        raise ge.GlusterStopProcessesFailedException(rc)
     return True
 
 
@@ -752,6 +767,10 @@
     def snapshotScheduleReset(self, options=None):
         self.svdsmProxy.glusterSnapshotScheduleFlagUpdate("none")
 
+    @exportAsVerb
+    def stopProcesses(self):
+        self.svdsmProxy.glusterStopProcesses()
+
 
 def getGlusterMethods(gluster):
     l = []
diff --git a/vdsm/gluster/apiwrapper.py b/vdsm/gluster/apiwrapper.py
index 4768a86..13dc859 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 stopProcesses(self):
+        return self._gluster.stopProcesses()
+
 
 class GlusterService(GlusterApiBase):
     def __init__(self):
diff --git a/vdsm/gluster/exception.py b/vdsm/gluster/exception.py
index 17ad018..2898d3d 100644
--- a/vdsm/gluster/exception.py
+++ b/vdsm/gluster/exception.py
@@ -594,6 +594,12 @@
     message = "Failed to disable snapshot schedule through cli"
 
 
+class GlusterStopProcessesFailedException(
+        GlusterVolumeException):
+    code = 4579
+    message = "Failed to stop gluster processes"
+
+
 # geo-replication
 class GlusterGeoRepException(GlusterException):
     code = 4200
diff --git a/vdsm/rpc/vdsmapi-gluster-schema.json b/vdsm/rpc/vdsmapi-gluster-schema.json
index c86f43c..2853851 100644
--- a/vdsm/rpc/vdsmapi-gluster-schema.json
+++ b/vdsm/rpc/vdsmapi-gluster-schema.json
@@ -1299,6 +1299,19 @@
  'returns': 'bool'}
 
 ##
+# @GlusterHost.stopProcesses:
+#
+# Stops the gluster processes on the host
+#
+# Returns:
+# Success or failure
+#
+# Since: 4.17.0
+##
+{'command': {'class': 'GlusterHost', 'name': 'stopProcesses'},
+ 'returns': 'bool'}
+
+##
 # @GlusterVolumeStatsInfo:
 #
 # Gluster Volumes disk usage statistics


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id686e098b323eededcf1f89de331a1d524274995
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Shubhendu Tripathi <shtripat at redhat.com>


More information about the vdsm-patches mailing list