diff options
author | Jose Castillo <jcastillo@redhat.com> | 2015-02-27 15:38:34 +0100 |
---|---|---|
committer | Peter Rajnoha <prajnoha@redhat.com> | 2015-02-27 15:38:34 +0100 |
commit | 57e9e76da4a678957e2db07a4b6b5f75385d4539 (patch) | |
tree | 87131bb9b9a664031a71773675696703fd5a8982 | |
parent | 379fb90b05b9fae0559fb697981198d8bb58e0f9 (diff) | |
download | lvm2-57e9e76da4a678957e2db07a4b6b5f75385d4539.tar.gz |
initscripts: lvm2-monitor: implement status action
Two new functions added in the init script: rh_status and rh_status_q.
First one to be used in status() and second one to be used in start(),
stop(), force_stop(). Check for 'dmeventd' added and print list of
lvs being monitored in status().
-rw-r--r-- | WHATS_NEW | 1 | ||||
-rw-r--r-- | scripts/lvm2_monitoring_init_red_hat.in | 17 |
2 files changed, 17 insertions, 1 deletions
@@ -1,5 +1,6 @@ Version 2.02.117 - ==================================== + Implement status action for lvm2-monitor initscript to display monitored LVs. Allow lvchange -p to change kernel state only if metadata state differs. Fix incorrect persistent .cache after report with label fields only (2.02.106). Reinstate PV tag recognition for pvs if reporting label fields only (2.02.105). diff --git a/scripts/lvm2_monitoring_init_red_hat.in b/scripts/lvm2_monitoring_init_red_hat.in index 44de07f1b..90b6edc63 100644 --- a/scripts/lvm2_monitoring_init_red_hat.in +++ b/scripts/lvm2_monitoring_init_red_hat.in @@ -32,18 +32,28 @@ . /etc/init.d/functions DAEMON=lvm2-monitor +DMEVENTD_DAEMON=dmeventd exec_prefix=@exec_prefix@ sbindir=@sbindir@ VGCHANGE=${sbindir}/vgchange VGS=${sbindir}/vgs +LVS=${sbindir}/lvs LOCK_FILE="/var/lock/subsys/$DAEMON" +PID_FILE="/var/run/dmeventd.pid" WARN=1 export LVM_SUPPRESS_LOCKING_FAILURE_MESSAGES=1 +rh_status() { + status -p $PID_FILE $DMEVENTD_DAEMON +} + +rh_status_q() { + rh_status >/dev/null 2>&1 +} start() { ret=0 @@ -79,12 +89,14 @@ rtrn=1 # See how we were called. case "$1" in start) + rh_status_q && exit 0 start rtrn=$? [ $rtrn = 0 ] && touch $LOCK_FILE ;; force-stop) + rh_status_q || exit 0 WARN=0 stop rtrn=$? @@ -92,6 +104,7 @@ case "$1" in ;; stop) + rh_status_q || exit 0 test "$runlevel" = "0" && WARN=0 test "$runlevel" = "6" && WARN=0 stop @@ -109,7 +122,9 @@ case "$1" in ;; status) - # TODO anyone with an idea how to dump monitored volumes? + rh_status + rtrn=$? + [ $rtrn = 0 ] && $LVS -S 'seg_monitor=monitored' -o lv_full_name,seg_monitor ;; *) |