LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File cman_init_check_if_corosync_is_running.patch of Package cluster (Project home:sschapiro:openstack:upstream)

commit b6c1fb8865b2b68cec3296ec182598f8c8c89cc8
Author: Jan Friesse <jfriesse@redhat.com>
Date:   Mon Sep 27 15:23:49 2010 +0200

    Cman: test that corosync is not already running
    
    Patch fixes init file so now before cman start is tested, if corosync is
    running. If so, init script will refuse to start.
    
    Resolves: rhbz#617234

diff --git a/cman/init.d/cman.in b/cman/init.d/cman.in
index e8eba61..a6545aa 100644
--- a/cman/init.d/cman.in
+++ b/cman/init.d/cman.in
@@ -461,11 +461,25 @@ stop_configfs()
 	fi
 }
 
+corosync_running()
+{
+	[ -f /var/run/corosync.pid ] || return 1
+
+	read corosync_pid foo < /var/run/corosync.pid
+	if [ "$(pidof corosync)" == "$corosync_pid" ];then
+		errmsg="Corosync Cluster Engine is already running"
+		return 0
+	fi
+
+	return 1
+}
+
 start_cman()
 {
 	check_exec cman_tool || return $?
 	cman_running && return 0
 	cman_checkconfig || return 1
+	corosync_running && return 1
 
 	tmpfile=$(mktemp -t cmanstartup.XXXXXXXXXX)
 	if [ -z "$tmpfile" ]; then