Hello Sandro Bonazzola,

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

    https://gerrit.ovirt.org/40240

to review the following change.

Change subject: storageServer: Run glusterfs as systemd service
......................................................................

storageServer: Run glusterfs as systemd service

When mounting glusterfs volume, glusterfs command is started in the vdsm
cgroup. When vdsm exits, glusterfs dies and vms using gluserfs volumes pause.
Now we run glusterfs mount command using systemd-run, so it run it its own
cgroup, and last after vdsm exit.

Change-Id: I79714a9a6ecbde17c396eca6b17b9e3605fad688
Bug-Url: https://bugzilla.redhat.com/1201355
Signed-off-by: Sandro Bonazzola <sbona...@redhat.com>
Signed-off-by: Nir Soffer <nsof...@redhat.com>
---
M vdsm/storage/mount.py
M vdsm/storage/storageServer.py
2 files changed, 13 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/40/40240/1

diff --git a/vdsm/storage/mount.py b/vdsm/storage/mount.py
index fefa5df..6afceae 100644
--- a/vdsm/storage/mount.py
+++ b/vdsm/storage/mount.py
@@ -212,7 +212,7 @@
         hsh ^= hash(self.fs_file)
         return hsh
 
-    def mount(self, mntOpts=None, vfstype=None, timeout=None):
+    def mount(self, mntOpts=None, vfstype=None, timeout=None, modifier=None):
         cmd = [constants.EXT_MOUNT]
 
         if vfstype is not None:
@@ -223,6 +223,9 @@
 
         cmd.extend((self.fs_spec, self.fs_file))
 
+        if modifier:
+            cmd = modifier(cmd)
+
         return self._runcmd(cmd, timeout)
 
     def _runcmd(self, cmd, timeout):
diff --git a/vdsm/storage/storageServer.py b/vdsm/storage/storageServer.py
index 22a90d1..5009e50 100644
--- a/vdsm/storage/storageServer.py
+++ b/vdsm/storage/storageServer.py
@@ -31,6 +31,7 @@
 
 from vdsm.compat import pickle
 from vdsm.config import config
+from vdsm import cmdutils
 
 import mount
 import fileUtils
@@ -201,14 +202,14 @@
                             self._remotePath.replace("_",
                                                      "__").replace("/", "_"))
 
-    def connect(self):
+    def connect(self, modifier=None):
         if self._mount.isMounted():
             return
 
         fileUtils.createdir(self._getLocalPath())
 
         try:
-            self._mount.mount(self.options, self._vfsType)
+            self._mount.mount(self.options, self._vfsType, modifier=modifier)
         except MountError:
             t, v, tb = sys.exc_info()
             try:
@@ -258,6 +259,12 @@
     def getLocalPathBase(cls):
         return os.path.join(MountConnection.getLocalPathBase(), "glusterSD")
 
+    def connect(self):
+        # Run the mount command as a systemd service, so glusterfs command run
+        # in its own cgroup, and will not die when vdsm is terminated.
+        modifier = partial(cmdutils.systemd_run, scope=True, unit='glusterfs')
+        MountConnection.connect(self, modifier=modifier)
+
 
 class NFSConnection(object):
     DEFAULT_OPTIONS = ["soft", "nosharecache"]


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I79714a9a6ecbde17c396eca6b17b9e3605fad688
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <nsof...@redhat.com>
Gerrit-Reviewer: Sandro Bonazzola <sbona...@redhat.com>
_______________________________________________
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to