From: Marcin Krol Date: Mon, 5 Oct 2015 19:24:41 +0000 (+0000) Subject: - rework clvmd a bit too X-Git-Url: https://git.tld-linux.org/?p=packages%2Flvm2.git;a=commitdiff_plain;h=014e74153e9ccd17578b56aac2fb70a7d09765b5 - rework clvmd a bit too - silence status calls --- diff --git a/lvm2-tld_init.patch b/lvm2-tld_init.patch index bfaea6f..3d9f95a 100644 --- a/lvm2-tld_init.patch +++ b/lvm2-tld_init.patch @@ -1,6 +1,6 @@ diff -ur LVM2.2.02.132.orig/scripts/blk_availability_init_red_hat.in LVM2.2.02.132/scripts/blk_availability_init_red_hat.in --- LVM2.2.02.132.orig/scripts/blk_availability_init_red_hat.in 2015-09-22 15:00:59.000000000 +0000 -+++ LVM2.2.02.132/scripts/blk_availability_init_red_hat.in 2015-10-05 11:36:09.176042000 +0000 ++++ LVM2.2.02.132/scripts/blk_availability_init_red_hat.in 2015-10-05 12:31:30.991042000 +0000 @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh @@ -46,28 +46,82 @@ diff -ur LVM2.2.02.132.orig/scripts/blk_availability_init_red_hat.in LVM2.2.02.1 esac diff -ur LVM2.2.02.132.orig/scripts/clvmd_init_red_hat.in LVM2.2.02.132/scripts/clvmd_init_red_hat.in --- LVM2.2.02.132.orig/scripts/clvmd_init_red_hat.in 2015-09-22 15:00:59.000000000 +0000 -+++ LVM2.2.02.132/scripts/clvmd_init_red_hat.in 2015-10-05 09:44:25.805042000 +0000 -@@ -61,9 +61,8 @@ ++++ LVM2.2.02.132/scripts/clvmd_init_red_hat.in 2015-10-05 19:20:56.249042000 +0000 +@@ -18,15 +18,12 @@ + + . /etc/rc.d/init.d/functions + +-DAEMON=clvmd ++DAEMON="clvmd" + +-exec_prefix=@exec_prefix@ +-sbindir=@sbindir@ +- +-lvm_vgchange=${sbindir}/vgchange +-lvm_vgs=${sbindir}/vgs +-lvm_vgscan=${sbindir}/vgscan +-lvm_lvs=${sbindir}/lvs ++lvm_vgchange="/sbin/vgchange" ++lvm_vgs="/sbin/vgs" ++lvm_vgscan="/sbin/vgscan" ++lvm_lvs="/sbin/lvs" + + CLVMDOPTS="-T30" + +@@ -50,20 +47,11 @@ + ${lvm_lvs} --noheadings -o lv_name -S 'vg_clustered=1 && lv_active!=""' 2>/dev/null + } + +-rh_status() { +- status $DAEMON +-} +- +-rh_status_q() { +- rh_status >/dev/null 2>&1 +-} +- start() { - if ! rh_status_q; then +- if ! rh_status_q; then - echo -n "Starting $DAEMON: " ++ if ! status $DAEMON 1>/dev/null 2>&1; then + msg_starting "$DAEMON" $DAEMON $CLVMDOPTS || return $? - echo fi # Refresh local cache. -@@ -83,7 +82,7 @@ +@@ -82,74 +70,62 @@ + # unnecessary warnings. ${lvm_vgscan} > /dev/null 2>&1 - +- - action "Activating VG(s):" ${lvm_vgchange} -aay $LVM_VGS || return $? +- + run_cmd "Activating VG(s):" ${lvm_vgchange} -aay $LVM_VGS || return $? - touch $LOCK_FILE +- + return 0 + } + + wait_for_finish() + { + count=0 +- while [ "$count" -le "$CLVMD_STOP_TIMEOUT" ] && \ +- rh_status_q ]; do ++ while [ "$count" -le "$CLVMD_STOP_TIMEOUT" ] && status $DAEMON 1>/dev/null 2>&1 ; do + sleep 1 + count=$((count+1)) + done +- +- ! rh_status_q ++ ! status $DAEMON 1>/dev/null 2>&1 + } -@@ -108,27 +107,23 @@ + stop() + { +- rh_status_q || return 0 ++ status $DAEMON 1>/dev/null 2>&1 || return 0 [ -z "$LVM_VGS" ] && LVM_VGS="$(clustered_vgs)" if [ -n "$LVM_VGS" ]; then @@ -84,12 +138,13 @@ diff -ur LVM2.2.02.132.orig/scripts/clvmd_init_red_hat.in LVM2.2.02.132/scripts/ # clvmd could take some time to stop - rh_status_q && action "Waiting for $DAEMON to exit:" wait_for_finish -+ rh_status_q && run_cmd "Waiting for $DAEMON to exit:" wait_for_finish - - if rh_status_q; then +- +- if rh_status_q; then - echo -n "$DAEMON failed to exit" - failure - echo ++ status $DAEMON 1>/dev/null 2>&1 && run_cmd "Waiting for $DAEMON to exit:" wait_for_finish ++ if status $DAEMON 1>/dev/null 2>&1; then + fail return 1 else @@ -98,18 +153,25 @@ diff -ur LVM2.2.02.132.orig/scripts/clvmd_init_red_hat.in LVM2.2.02.132/scripts/ - echo + ok fi - +- rm -f $LOCK_FILE -@@ -138,7 +133,7 @@ +- + return 0 + } reload() { - rh_status_q || exit 7 +- rh_status_q || exit 7 - action "Reloading $DAEMON configuration: " $DAEMON -R || return $? ++ status $DAEMON 1>/dev/null 2>&1 || exit 7 + run_cmd "Reloading $DAEMON configuration: " $DAEMON -R || return $? } restart() { -@@ -149,7 +144,7 @@ + # if stop fails, restart will return the error and not attempt +- # another start. Even if start is protected by rh_status_q, ++ # another start. Even if start is protected by status call, + # that would avoid spawning another daemon, it would try to + # reactivate the VGs. # Try to get clvmd to restart itself. This will preserve # exclusive LV locks @@ -118,9 +180,72 @@ diff -ur LVM2.2.02.132.orig/scripts/clvmd_init_red_hat.in LVM2.2.02.132/scripts/ # If that fails then do a normal stop & restart if [ $? != 0 ]; then +@@ -166,49 +142,43 @@ + exit 4 + } + ++RETVAL=0 + # See how we were called. + case "$1" in + start) + start +- rtrn=$? ++ RETVAL=$? + ;; +- + stop) + stop +- rtrn=$? ++ RETVAL=$? + ;; +- + restart|force-reload) + restart +- rtrn=$? ++ RETVAL=$? + ;; +- + condrestart|try-restart) +- rh_status_q || exit 0 ++ status $DAEMON 1>/dev/null 2>&1 || exit 0 + restart +- rtrn=$? ++ RETVAL=$? + ;; +- + reload) + reload +- rtrn=$? ++ RETVAL=$? + ;; +- + status) +- rh_status +- rtrn=$? +- if [ $rtrn = 0 ]; then ++ status $DAEMON ++ RETVAL=$? ++ if [ $RETVAL = 0 ]; then + cvgs="$(clustered_vgs)" + echo Clustered Volume Groups: ${cvgs:-"(none)"} + clvs="$(clustered_active_lvs)" + echo Active clustered Logical Volumes: ${clvs:-"(none)"} + fi + ;; +- + *) +- echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}" +- rtrn=2 ++ msg_usage "$0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}" ++ RETVAL=2 + ;; + esac +- +-exit $rtrn ++exit $RETVAL diff -ur LVM2.2.02.132.orig/scripts/lvm2_lvmetad_init_red_hat.in LVM2.2.02.132/scripts/lvm2_lvmetad_init_red_hat.in --- LVM2.2.02.132.orig/scripts/lvm2_lvmetad_init_red_hat.in 2015-09-22 15:00:59.000000000 +0000 -+++ LVM2.2.02.132/scripts/lvm2_lvmetad_init_red_hat.in 2015-10-05 11:12:06.584042000 +0000 ++++ LVM2.2.02.132/scripts/lvm2_lvmetad_init_red_hat.in 2015-10-05 12:31:30.993042000 +0000 @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh @@ -255,7 +380,7 @@ diff -ur LVM2.2.02.132.orig/scripts/lvm2_lvmetad_init_red_hat.in LVM2.2.02.132/s +exit $RETVAL diff -ur LVM2.2.02.132.orig/scripts/lvm2_lvmpolld_init_red_hat.in LVM2.2.02.132/scripts/lvm2_lvmpolld_init_red_hat.in --- LVM2.2.02.132.orig/scripts/lvm2_lvmpolld_init_red_hat.in 2015-09-22 15:00:59.000000000 +0000 -+++ LVM2.2.02.132/scripts/lvm2_lvmpolld_init_red_hat.in 2015-10-05 11:11:58.892042000 +0000 ++++ LVM2.2.02.132/scripts/lvm2_lvmpolld_init_red_hat.in 2015-10-05 12:31:30.993042000 +0000 @@ -1,6 +1,6 @@ -#!/bin/bash +#!/bin/sh @@ -403,7 +528,7 @@ diff -ur LVM2.2.02.132.orig/scripts/lvm2_lvmpolld_init_red_hat.in LVM2.2.02.132/ +exit $RETVAL diff -ur LVM2.2.02.132.orig/scripts/lvm2_monitoring_init_red_hat.in LVM2.2.02.132/scripts/lvm2_monitoring_init_red_hat.in --- LVM2.2.02.132.orig/scripts/lvm2_monitoring_init_red_hat.in 2015-09-22 15:00:59.000000000 +0000 -+++ LVM2.2.02.132/scripts/lvm2_monitoring_init_red_hat.in 2015-10-05 11:33:13.048042000 +0000 ++++ LVM2.2.02.132/scripts/lvm2_monitoring_init_red_hat.in 2015-10-05 12:32:01.204042000 +0000 @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh @@ -485,7 +610,7 @@ diff -ur LVM2.2.02.132.orig/scripts/lvm2_monitoring_init_red_hat.in LVM2.2.02.13 case "$1" in start) - rh_status_q && exit 0 -+ status $DMEVENTD_DAEMON || exit 0 ++ status $DMEVENTD_DAEMON 1>/dev/null 2>&1 && exit 0 start - rtrn=$? - [ $rtrn = 0 ] && touch $LOCK_FILE @@ -495,7 +620,7 @@ diff -ur LVM2.2.02.132.orig/scripts/lvm2_monitoring_init_red_hat.in LVM2.2.02.13 - force-stop) - rh_status_q || exit 0 -+ status $DMEVENTD_DAEMON || exit 0 ++ status $DMEVENTD_DAEMON 1>/dev/null 2>&1 || exit 0 WARN=0 stop - rtrn=$? @@ -506,7 +631,7 @@ diff -ur LVM2.2.02.132.orig/scripts/lvm2_monitoring_init_red_hat.in LVM2.2.02.13 - stop) - rh_status_q || exit 0 -+ status $DMEVENTD_DAEMON || exit 0 ++ status $DMEVENTD_DAEMON 1>/dev/null 2>&1 || exit 0 test "$runlevel" = "0" && WARN=0 test "$runlevel" = "6" && WARN=0 stop