]> TLD Linux GIT Repositories - packages/lvm2.git/blob - lvm2-tld_init.patch
- updated to 2.02.140
[packages/lvm2.git] / lvm2-tld_init.patch
1 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
2 --- LVM2.2.02.132.orig/scripts/blk_availability_init_red_hat.in 2015-09-22 15:00:59.000000000 +0000
3 +++ LVM2.2.02.132/scripts/blk_availability_init_red_hat.in      2015-10-05 12:31:30.991042000 +0000
4 @@ -1,4 +1,4 @@
5 -#!/bin/bash
6 +#!/bin/sh
7  #
8  # Copyright (C) 2012 Red Hat, Inc. All rights reserved.
9  #
10 @@ -31,28 +31,26 @@
11  
12  . /etc/init.d/functions
13  
14 -sbindir=@sbindir@
15 -script=blkdeactivate
16 -options="-u -l wholevg"
17 +DAEMON="blkdeactivate"
18 +OPTIONS="-u -l wholevg"
19  
20  LOCK_FILE="/var/lock/subsys/blk-availability"
21  
22 -
23 -rtrn=1
24 -
25  case "$1" in
26    start)
27         touch $LOCK_FILE
28 +       exit 0
29         ;;
30 -
31    stop)
32 -       action "Stopping block device availability:" $sbindir/$script $options
33 +       run_cmd "Stopping block device availability:" /sbin/$DAEMON $OPTIONS
34         rm -f $LOCK_FILE
35 +       exit 0
36         ;;
37 -
38    status)
39 +       exit 0
40         ;;
41    *)
42 -       echo $"Usage: $0 {start|stop|status}"
43 +       msg_usage "$0 {start|stop|status}"
44 +       exit 3
45         ;;
46  esac
47 diff -ur LVM2.2.02.132.orig/scripts/clvmd_init_red_hat.in LVM2.2.02.132/scripts/clvmd_init_red_hat.in
48 --- LVM2.2.02.132.orig/scripts/clvmd_init_red_hat.in    2015-09-22 15:00:59.000000000 +0000
49 +++ LVM2.2.02.132/scripts/clvmd_init_red_hat.in 2015-10-05 19:20:56.249042000 +0000
50 @@ -18,15 +18,12 @@
51  
52  . /etc/rc.d/init.d/functions
53  
54 -DAEMON=clvmd
55 +DAEMON="clvmd"
56  
57 -exec_prefix=@exec_prefix@
58 -sbindir=@sbindir@
59 -
60 -lvm_vgchange=${sbindir}/vgchange
61 -lvm_vgs=${sbindir}/vgs
62 -lvm_vgscan=${sbindir}/vgscan
63 -lvm_lvs=${sbindir}/lvs
64 +lvm_vgchange="/sbin/vgchange"
65 +lvm_vgs="/sbin/vgs"
66 +lvm_vgscan="/sbin/vgscan"
67 +lvm_lvs="/sbin/lvs"
68  
69  CLVMDOPTS="-T30"
70  
71 @@ -50,20 +47,11 @@
72         ${lvm_lvs} --noheadings -o lv_name -S 'vg_clustered=1 && lv_active!=""' 2>/dev/null
73  }
74  
75 -rh_status() {
76 -       status $DAEMON
77 -}
78 -
79 -rh_status_q() {
80 -       rh_status >/dev/null 2>&1
81 -}
82 -
83  start()
84  {
85 -       if ! rh_status_q; then
86 -               echo -n "Starting $DAEMON: "
87 +       if ! status $DAEMON 1>/dev/null 2>&1; then
88 +               msg_starting "$DAEMON"
89                 $DAEMON $CLVMDOPTS || return $?
90 -               echo
91         fi
92  
93         # Refresh local cache.
94 @@ -82,74 +70,62 @@
95         # unnecessary warnings.
96  
97         ${lvm_vgscan} > /dev/null 2>&1
98 -
99 -       action "Activating VG(s):" ${lvm_vgchange} -aay $LVM_VGS || return $?
100 -
101 +       run_cmd "Activating VG(s):" ${lvm_vgchange} -aay $LVM_VGS || return $?
102         touch $LOCK_FILE
103 -
104         return 0
105  }
106  
107  wait_for_finish()
108  {
109         count=0
110 -       while [ "$count" -le "$CLVMD_STOP_TIMEOUT" ] && \
111 -                rh_status_q ]; do
112 +       while [ "$count" -le "$CLVMD_STOP_TIMEOUT" ] && status $DAEMON 1>/dev/null 2>&1 ; do
113                 sleep 1
114                 count=$((count+1))
115         done
116 -
117 -       ! rh_status_q
118 +       ! status $DAEMON 1>/dev/null 2>&1
119  }
120  
121  stop()
122  {
123 -       rh_status_q || return 0
124 +       status $DAEMON 1>/dev/null 2>&1 || return 0
125  
126         [ -z "$LVM_VGS" ] && LVM_VGS="$(clustered_vgs)"
127         if [ -n "$LVM_VGS" ]; then
128 -               action "Deactivating clustered VG(s):" ${lvm_vgchange} -anl $LVM_VGS || return $?
129 +               run_cmd "Deactivating clustered VG(s):" ${lvm_vgchange} -anl $LVM_VGS || return $?
130         fi
131  
132 -       action "Signaling $DAEMON to exit" kill -TERM $(pidofproc $DAEMON) || return $?
133 +       run_cmd "Signaling $DAEMON to exit" kill -TERM $(pidofproc $DAEMON) || return $?
134  
135         # wait half second before we start the waiting loop or we will show
136         # the loop more time than really necessary
137         usleep 500000
138  
139         # clvmd could take some time to stop
140 -       rh_status_q && action "Waiting for $DAEMON to exit:" wait_for_finish
141 -
142 -       if rh_status_q; then
143 -               echo -n "$DAEMON failed to exit"
144 -               failure
145 -               echo
146 +       status $DAEMON 1>/dev/null 2>&1 && run_cmd "Waiting for $DAEMON to exit:" wait_for_finish
147 +       if status $DAEMON 1>/dev/null 2>&1; then
148 +               fail
149                 return 1
150         else
151 -               echo -n "$DAEMON terminated"
152 -               success
153 -               echo
154 +               ok
155         fi
156 -
157         rm -f $LOCK_FILE
158 -
159         return 0
160  }
161  
162  reload() {
163 -       rh_status_q || exit 7
164 -       action "Reloading $DAEMON configuration: " $DAEMON -R || return $?
165 +       status $DAEMON 1>/dev/null 2>&1 || exit 7
166 +       run_cmd "Reloading $DAEMON configuration: " $DAEMON -R || return $?
167  }
168  
169  restart() {
170         # if stop fails, restart will return the error and not attempt
171 -       # another start. Even if start is protected by rh_status_q,
172 +       # another start. Even if start is protected by status call,
173         # that would avoid spawning another daemon, it would try to
174         # reactivate the VGs.
175  
176         # Try to get clvmd to restart itself. This will preserve 
177         # exclusive LV locks
178 -       action "Restarting $DAEMON: " $DAEMON -S
179 +       run_cmd "Restarting $DAEMON: " $DAEMON -S
180  
181         # If that fails then do a normal stop & restart
182         if  [ $? != 0 ]; then
183 @@ -166,49 +142,43 @@
184         exit 4
185  }
186  
187 +RETVAL=0
188  # See how we were called.
189  case "$1" in
190    start)
191         start
192 -       rtrn=$?
193 +       RETVAL=$?
194         ;;
195 -
196    stop)
197         stop
198 -       rtrn=$?
199 +       RETVAL=$?
200         ;;
201 -
202    restart|force-reload)
203         restart
204 -       rtrn=$?
205 +       RETVAL=$?
206         ;;
207 -
208    condrestart|try-restart)
209 -       rh_status_q || exit 0
210 +       status $DAEMON 1>/dev/null 2>&1 || exit 0
211         restart
212 -       rtrn=$? 
213 +       RETVAL=$? 
214         ;;
215 -
216    reload)
217         reload
218 -       rtrn=$?
219 +       RETVAL=$?
220         ;;
221 -
222    status)
223 -       rh_status
224 -       rtrn=$?
225 -       if [ $rtrn = 0 ]; then
226 +       status $DAEMON
227 +       RETVAL=$?
228 +       if [ $RETVAL = 0 ]; then
229                 cvgs="$(clustered_vgs)"
230                 echo Clustered Volume Groups: ${cvgs:-"(none)"}
231                 clvs="$(clustered_active_lvs)"
232                 echo Active clustered Logical Volumes: ${clvs:-"(none)"}
233         fi
234         ;;
235 -
236    *)
237 -       echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
238 -       rtrn=2
239 +       msg_usage "$0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
240 +       RETVAL=2
241         ;;
242  esac
243 -
244 -exit $rtrn
245 +exit $RETVAL
246 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
247 --- LVM2.2.02.132.orig/scripts/lvm2_lvmetad_init_red_hat.in     2015-09-22 15:00:59.000000000 +0000
248 +++ LVM2.2.02.132/scripts/lvm2_lvmetad_init_red_hat.in  2015-10-06 06:06:01.799042000 +0000
249 @@ -1,4 +1,4 @@
250 -#!/bin/bash
251 +#!/bin/sh
252  #
253  # Copyright (C) 2012 Red Hat, Inc. All rights reserved.
254  #
255 @@ -33,80 +33,76 @@
256  
257  . /etc/init.d/functions
258  
259 -DAEMON=lvmetad
260 +DAEMON="lvmetad"
261 +NAME="LVM metadata daemon"
262  
263 -exec_prefix=@exec_prefix@
264 -sbindir=@sbindir@
265 -
266 -LOCK_FILE="/var/lock/subsys/$DAEMON"
267 +LOCK_FILE="/var/lock/subsys/lvm2-lvmetad"
268  PID_FILE="@LVMETAD_PIDFILE@"
269  
270 -rh_status() {
271 -       status -p $PID_FILE $DAEMON
272 +start() {
273 +       if [ -f $LOCK_FILE ]; then
274 +               msg_already_running "$NAME"
275 +               return
276 +       fi
277 +        msg_starting "$NAME"
278 +        daemon /sbin/$DAEMON </dev/null
279 +        RETVAL=$?
280 +        [ $RETVAL -eq 0 ] && touch $LOCK_FILE
281  }
282  
283 -rh_status_q() {
284 -       rh_status >/dev/null 2>&1
285 +stop() {
286 +        if [ ! -f $LOCK_FILE ]; then
287 +                msg_not_running "$NAME"
288 +                return
289 +        fi
290 +        msg_stopping "$NAME"
291 +        killproc --pidfile $PID_FILE $DAEMON
292 +        rm -f $LOCK_FILE
293  }
294  
295 -start()
296 -{
297 -       ret=0
298 -       action "Starting LVM metadata daemon:" $DAEMON || ret=$?
299 -       return $ret
300 +condrestart() {
301 +        if [ ! -f $LOCK_FILE ]; then
302 +                msg_not_running "$NAME"
303 +                RETVAL=$1
304 +                return
305 +        fi
306 +        stop
307 +        start
308  }
309  
310 -
311 -stop()
312 -{
313 -       ret=0
314 -       action "Signaling LVM metadata daemon to exit:" killproc -p $PID_FILE $DAEMON -TERM || ret=$?
315 -       return $ret
316 +reload() {
317 +        if [ ! -f $LOCK_FILE ]; then
318 +                msg_not_running "$NAME"
319 +                RETVAL=7
320 +                return
321 +        fi
322 +        msg_reloading "$NAME"
323 +        killproc $DAEMON -HUP
324 +        RETVAL=$?
325  }
326  
327 -rtrn=1
328 -
329 +RETVAL=0
330  # See how we were called.
331  case "$1" in
332    start)
333 -       rh_status_q && exit 0
334         start
335 -       rtrn=$?
336 -       [ $rtrn = 0 ] && touch $LOCK_FILE
337         ;;
338 -
339 -  stop|force-stop)
340 -       rh_status_q || exit 0
341 +  stop)
342         stop
343 -       rtrn=$?
344 -       [ $rtrn = 0 ] && rm -f $LOCK_FILE
345         ;;
346 -
347    restart)
348 -       if stop
349 -       then
350 -               start
351 -       fi
352 -       rtrn=$?
353 +       stop
354 +       start
355         ;;
356 -
357    condrestart|try-restart)
358 -       rh_status_q || exit 0
359 -       if stop
360 -       then
361 -               start
362 -       fi
363 -       rtrn=$?
364 +       condrestart 0
365         ;;
366 -
367    status)
368 -       rh_status
369 -       rtrn=$?
370 +       status $DAEMON
371 +       exit $?
372         ;;
373 -
374    *)
375 -       echo $"Usage: $0 {start|stop|force-stop|restart|condrestart|try-restart|status}"
376 +       msg_usage "$0 {start|stop|force-stop|restart|condrestart|try-restart|status}"
377         ;;
378  esac
379 -
380 -exit $rtrn
381 +exit $RETVAL
382 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
383 --- LVM2.2.02.132.orig/scripts/lvm2_lvmpolld_init_red_hat.in    2015-09-22 15:00:59.000000000 +0000
384 +++ LVM2.2.02.132/scripts/lvm2_lvmpolld_init_red_hat.in 2015-10-06 06:07:04.889042000 +0000
385 @@ -1,6 +1,6 @@
386 -#!/bin/bash
387 +#!/bin/sh
388  #
389 -# Copyright (C) 2015 Red Hat, Inc. All rights reserved.
390 +# Copyright (C) 2012 Red Hat, Inc. All rights reserved.
391  #
392  # This copyrighted material is made available to anyone wishing to use,
393  # modify, copy, or redistribute it subject to the terms and conditions
394 @@ -27,88 +27,84 @@
395  # Default-Start: 1 2 3 4 5
396  # Default-Stop: 0 6
397  # Short-Description: A daemon that is responsible for monitoring in-progress
398 -#                   and possibly longer term operations on logical volumes. 
399 -#                   It helps to reduce the number of spawned processes if same
400 +#                    and possibly longer term operations on logical volumes.
401 +#                    It helps to reduce the number of spawned processes if same
402  #                    logical volume is requested to get monitored multiple times.
403  #                    Also avoids unsolicited termination due to external factors.
404  ### END INIT INFO
405  
406  . /etc/init.d/functions
407  
408 -DAEMON=lvmpolld
409 +DAEMON="lvmpolld"
410 +NAME="LVM poll daemon"
411  
412 -exec_prefix=@exec_prefix@
413 -sbindir=@sbindir@
414 -
415 -LOCK_FILE="/var/lock/subsys/$DAEMON"
416 +LOCK_FILE="/var/lock/subsys/lvm2-lvmpolld"
417  PID_FILE="@LVMPOLLD_PIDFILE@"
418  
419 -rh_status() {
420 -       status -p $PID_FILE $DAEMON
421 +start() {
422 +       if [ -f $LOCK_FILE ]; then
423 +               msg_already_running "$NAME"
424 +               return
425 +       fi
426 +        msg_starting "$NAME"
427 +        daemon /sbin/$DAEMON </dev/null
428 +        RETVAL=$?
429 +        [ $RETVAL -eq 0 ] && touch $LOCK_FILE
430  }
431  
432 -rh_status_q() {
433 -       rh_status >/dev/null 2>&1
434 +stop() {
435 +        if [ ! -f $LOCK_FILE ]; then
436 +                msg_not_running "$NAME"
437 +                return
438 +        fi
439 +        msg_stopping "$NAME"
440 +        killproc --pidfile $PID_FILE $DAEMON
441 +        rm -f $LOCK_FILE
442  }
443  
444 -start()
445 -{
446 -       ret=0
447 -       action "Starting LVM poll daemon:" $DAEMON || ret=$?
448 -       return $ret
449 +condrestart() {
450 +        if [ ! -f $LOCK_FILE ]; then
451 +                msg_not_running "$NAME"
452 +                RETVAL=$1
453 +                return
454 +        fi
455 +        stop
456 +        start
457  }
458  
459 -
460 -stop()
461 -{
462 -       ret=0
463 -       action "Signaling LVM poll daemon to exit:" killproc -p $PID_FILE $DAEMON -TERM || ret=$?
464 -       return $ret
465 +reload() {
466 +        if [ ! -f $LOCK_FILE ]; then
467 +                msg_not_running "$NAME"
468 +                RETVAL=7
469 +                return
470 +        fi
471 +        msg_reloading "$NAME"
472 +        killproc $DAEMON -HUP
473 +        RETVAL=$?
474  }
475  
476 -rtrn=1
477 -
478 +RETVAL=0
479  # See how we were called.
480  case "$1" in
481    start)
482 -       rh_status_q && exit 0
483         start
484 -       rtrn=$?
485 -       [ $rtrn = 0 ] && touch $LOCK_FILE
486         ;;
487 -
488 -  stop|force-stop)
489 -       rh_status_q || exit 0
490 +  stop)
491         stop
492 -       rtrn=$?
493 -       [ $rtrn = 0 ] && rm -f $LOCK_FILE
494         ;;
495 -
496    restart)
497 -       if stop
498 -       then
499 -               start
500 -       fi
501 -       rtrn=$?
502 +       stop
503 +       start
504         ;;
505 -
506    condrestart|try-restart)
507 -       rh_status_q || exit 0
508 -       if stop
509 -       then
510 -               start
511 -       fi
512 -       rtrn=$?
513 +       condrestart 0
514         ;;
515 -
516    status)
517 -       rh_status
518 -       rtrn=$?
519 +       status $DAEMON
520 +       exit $?
521         ;;
522 -
523    *)
524 -       echo $"Usage: $0 {start|stop|force-stop|restart|condrestart|try-restart|status}"
525 +       msg_usage "$0 {start|stop|force-stop|restart|condrestart|try-restart|status}"
526         ;;
527  esac
528 -
529 -exit $rtrn
530 +exit $RETVAL
531 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
532 --- LVM2.2.02.132.orig/scripts/lvm2_monitoring_init_red_hat.in  2015-09-22 15:00:59.000000000 +0000
533 +++ LVM2.2.02.132/scripts/lvm2_monitoring_init_red_hat.in       2015-10-05 12:32:01.204042000 +0000
534 @@ -1,4 +1,4 @@
535 -#!/bin/bash
536 +#!/bin/sh
537  #
538  # Copyright (C) 2007-2009 Red Hat, Inc. All rights reserved.
539  #
540 @@ -31,15 +31,12 @@
541  
542  . /etc/init.d/functions
543  
544 -DAEMON=lvm2-monitor
545 -DMEVENTD_DAEMON=dmeventd
546 +DAEMON="lvm2-monitor"
547 +DMEVENTD_DAEMON="dmeventd"
548  
549 -exec_prefix=@exec_prefix@
550 -sbindir=@sbindir@
551 -
552 -VGCHANGE=${sbindir}/vgchange
553 -VGS=${sbindir}/vgs
554 -LVS=${sbindir}/lvs
555 +VGCHANGE="/sbin/vgchange"
556 +VGS="/sbin/vgs"
557 +LVS="/sbin/lvs"
558  
559  LOCK_FILE="/var/lock/subsys/$DAEMON"
560  PID_FILE="@DMEVENTD_PIDFILE@"
561 @@ -47,89 +44,69 @@
562  WARN=1
563  export LVM_SUPPRESS_LOCKING_FAILURE_MESSAGES=1
564  
565 -rh_status() {
566 -       status -p $PID_FILE $DMEVENTD_DAEMON
567 -}
568 -
569 -rh_status_q() {
570 -       rh_status >/dev/null 2>&1
571 -}
572  start()
573  {
574 -       ret=0
575 +       local config="'log{command_names=0 prefix=\"  \"}'"
576         # TODO do we want to separate out already active groups only?
577 -       VGSLIST=`$VGS --noheadings -o name --ignoreskippedcluster --config 'log{command_names=0 prefix="  "}' 2> /dev/null`
578 +       VGSLIST=`eval $VGS --noheadings -o name --ignoreskippedcluster --config $config 2> /dev/null`
579         for vg in $VGSLIST
580         do
581 -           action "Starting monitoring for VG $vg:" $VGCHANGE --monitor y --poll y --ignoreskippedcluster --config 'log{command_names=0 prefix="  "}' $vg || ret=$?
582 +           run_cmd "Starting monitoring for LVM VG $vg" $VGCHANGE --monitor y --poll y --ignoreskippedcluster --config $config $vg
583         done
584 -
585 -       return $ret
586  }
587  
588  
589  stop()
590  {
591 -       ret=0
592 +       local config="'log{command_names=0 prefix=\"  \"}'"
593         # TODO do we want to separate out already active groups only?
594         if test "$WARN" = "1"; then
595            echo "Not stopping monitoring, this is a dangerous operation. Please use force-stop to override."
596            return 1
597         fi
598 -       VGSLIST=`$VGS --noheadings -o name --ignoreskippedcluster --config 'log{command_names=0 prefix="  "}' 2> /dev/null`
599 +       VGSLIST=`eval $VGS --noheadings -o name --ignoreskippedcluster --config ${config} 2> /dev/null`
600         for vg in $VGSLIST
601         do
602 -           action "Stopping monitoring for VG $vg:" $VGCHANGE --monitor n --ignoreskippedcluster --config 'log{command_names=0 prefix="  "}' $vg || ret=$?
603 +           run_cmd "Stopping monitoring for LVM VG $vg" $VGCHANGE --monitor n --ignoreskippedcluster --config $config $vg
604         done
605 -       return $ret
606  }
607  
608 -rtrn=1
609 -
610 +RETVAL=0
611  # See how we were called.
612  case "$1" in
613    start)
614 -       rh_status_q && exit 0
615 +       status $DMEVENTD_DAEMON 1>/dev/null 2>&1 && exit 0
616         start
617 -       rtrn=$?
618 -       [ $rtrn = 0 ] && touch $LOCK_FILE
619 +       RETVAL=$?
620 +       [ $RETVAL = 0 ] && touch $LOCK_FILE
621         ;;
622 -
623    force-stop)
624 -       rh_status_q || exit 0
625 +       status $DMEVENTD_DAEMON 1>/dev/null 2>&1 || exit 0
626         WARN=0
627         stop
628 -       rtrn=$?
629 -       [ $rtrn = 0 ] && rm -f $LOCK_FILE
630 +       RETVAL=$?
631 +       [ $RETVAL = 0 ] && rm -f $LOCK_FILE
632         ;;
633 -
634    stop)
635 -       rh_status_q || exit 0
636 +       status $DMEVENTD_DAEMON 1>/dev/null 2>&1 || exit 0
637         test "$runlevel" = "0" && WARN=0
638         test "$runlevel" = "6" && WARN=0
639         stop
640 -       rtrn=$?
641 -       [ $rtrn = 0 ] && rm -f $LOCK_FILE
642 +       RETVAL=$?
643 +       [ $RETVAL = 0 ] && rm -f $LOCK_FILE
644         ;;
645 -
646    restart)
647         WARN=0
648 -       if stop
649 -       then
650 -               start
651 -       fi 
652 -       rtrn=$?
653 +       stop
654 +       start
655         ;;
656 -
657    status)
658 -       rh_status
659 -       rtrn=$?
660 -       [ $rtrn = 0 ] && $LVS -S 'seg_monitor=monitored' -o lv_full_name,seg_monitor
661 +       status $DMEVENTD_DAEMON
662 +       RETVAL=$?
663 +       [ $RETVAL = 0 ] && $LVS -S 'seg_monitor=monitored' -o lv_full_name,seg_monitor
664         ;;
665 -
666    *)
667 -       echo $"Usage: $0 {start|stop|restart|status|force-stop}"
668 +       msg_usage "$0 {start|stop|restart|status|force-stop}"
669         ;;
670  esac
671 -
672 -exit $rtrn
673 +exit $RETVAL