Federico Simoncelli has uploaded a new change for review.

Change subject: init: restart sanlock groups are missing
......................................................................

init: restart sanlock groups are missing

If sanlock was started before the *first* installation of vdsm
then it is probably missing the supplementary groups and it needs
to be restarted.

Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=977926
Change-Id: Idd3f8ffe10f771a09d0a779b148bb2ebaf95fecc
Signed-off-by: Federico Simoncelli <[email protected]>
---
M vdsm/vdsmd.init.in
1 file changed, 21 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/42/16742/1

diff --git a/vdsm/vdsmd.init.in b/vdsm/vdsmd.init.in
index ed8a944..30c4307 100755
--- a/vdsm/vdsmd.init.in
+++ b/vdsm/vdsmd.init.in
@@ -32,6 +32,7 @@
 CORE_DUMP_PATH=/var/log/core/core.%p.%t.dump
 DOM_METADATA_BACKUP_DIR=/var/log/vdsm/backup
 CORE_PATTERN=/proc/sys/kernel/core_pattern
+QEMU_GROUP=@QEMUGROUP@
 QEMU_DUMP_PATH="/var/log/core"
 NEEDED_SERVICES="iscsid multipathd rpcbind ntpd wdmd sanlock network libvirtd
                  supervdsmd"
@@ -243,6 +244,25 @@
     fi
 }
 
+configure_sanlock()
+{
+    local snlk_exec="sanlock"
+    local snlk_pidfile="/var/run/${snlk_exec}/${snlk_exec}.pid"
+    local snlk_pid=`pidofproc -p $snlk_pidfile $snlk_exec`
+    local snlk_proc_status="/proc/${snlk_pid}/status"
+
+    # If sanlock was started before the *first* installation of vdsm
+    # then it is probably missing the supplementary groups.
+    # Here we attempt to restart the service (when needed) to refresh
+    # the groups.
+    grep -q -e "^Groups:.* ${QEMU_GROUP}\( \|\$\)" "${snlk_proc_status}"
+
+    if [ $? != 0 ]; then
+        echo -n "Attempting to restart sanlock service:"
+        "$VDSM_TOOL" service-restart sanlock && success || failure
+    fi
+}
+
 # configure libvirt to vdsm's needs
 configure_libvirt()
 {
@@ -445,6 +465,7 @@
             ;;
     esac
     configure_libvirt $args
+    configure_sanlock
 }
 
 has_systemd() {


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

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

Reply via email to