ganesha-ha: more robust pid file handling
authorKaleb S. KEITHLEY <kkeithle@redhat.com>
Wed, 8 Apr 2015 12:03:58 +0000 (08:03 -0400)
committerNiels de Vos <ndevos@redhat.com>
Wed, 8 Apr 2015 17:50:09 +0000 (17:50 +0000)
fix bug with reading pid file to determine if ganesha.nfsd is running

Change-Id: I4050a119e2be93578045a221b67f616e152546d9
BUG: 1188184
Signed-off-by: Kaleb S. KEITHLEY <kkeithle@redhat.com>
Reviewed-on: http://review.gluster.org/10163
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Niels de Vos <ndevos@redhat.com>
extras/ganesha/ocf/ganesha_grace
extras/ganesha/ocf/ganesha_mon

index 45819c9a619baa3799f8b657a2bb5def46af874f..397b0abdeab948f8e467f67ced4670359405b44d 100644 (file)
@@ -94,7 +94,8 @@ ganesha_grace_start()
        # of the ganesha.nfsds have died, triggering a floating IP
        # address to move. Resource constraint location rules ensure
        # that this is invoked before the floating IP is moved.
-       if [ -d /proc/$(cat /var/run/ganesha.nfsd.pid) ]; then
+       if [ -e /var/run/ganesha.nfsd.pid -a \
+            -d /proc/$(cat /var/run/ganesha.nfsd.pid) ]; then
                # my ganesha.nfsd is still running
                # find out which one died?
 
index c03d7ee5ec974a6fd4f3865cd3d6f4389a0b6394..6ba7178235b93f87b3f2f1049928c02e9b53d8d8 100644 (file)
@@ -96,8 +96,9 @@ ganesha_mon_monitor()
 {
        local short_host=$(hostname -s)
 
-       if [ -d /proc/$(cat /var/run/ganesha.nfsd.pid) ]; then
-               # logger "ganesha_mon_monitor(), attrd_updater -n ganesha-active -v 1"
+       if [ -e /var/run/ganesha.nfsd.pid -a \
+            -d /proc/$(cat /var/run/ganesha.nfsd.pid) ]; then
+               # logger "note: ganesha_mon_monitor() pcs resource delete ${short_host}-dead_ip-1"
                pcs resource delete ${short_host}-dead_ip-1
                # if [ $? -ne 0 ]; then
                #       logger "warning: pcs resource delete ${short_host}-dead_ip-1"
@@ -111,8 +112,7 @@ ganesha_mon_monitor()
                fi
 
        else
-               # logger "ganesha_mon_monitor(), attrd_updater --D -n ganesha-active"
-
+               # logger "note: ganesha_mon_montor(), pcs resource create ${short_host}-dead_ip-1 ocf:heartbeat:Dummy"
                pcs resource create ${short_host}-dead_ip-1 ocf:heartbeat:Dummy
                if [ $? -ne 0 ]; then
                        logger "warning: pcs resource create ${short_host}-dead_ip-1 ocf:heartbeat:Dummy failed"