mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
scripts: clvmd: replace awk functionality with LVM's selection
No need to use awk now to get appropriate VGs/LVs, use LVM's own --select - it's quicker, it removes a need for external dependency on awk and it's also more readable.
This commit is contained in:
parent
fb7e2ff493
commit
6a77b6f43c
@ -1,5 +1,6 @@
|
||||
Version 2.02.115 -
|
||||
=====================================
|
||||
Use LVM's own selection instead of awk expressions in clvmd startup scripts.
|
||||
Do not filter out snapshot origin LVs as unusable devices for an LVM stack.
|
||||
Fix incorrect rimage names when converting from mirror to raid1 LV (2.02.112).
|
||||
Avoid excessive re-reading of metadata and related error messages in pvremove.
|
||||
|
@ -24,9 +24,9 @@ exec_prefix=@exec_prefix@
|
||||
sbindir=@sbindir@
|
||||
|
||||
lvm_vgchange=${sbindir}/vgchange
|
||||
lvm_vgdisplay=${sbindir}/vgdisplay
|
||||
lvm_vgs=${sbindir}/vgs
|
||||
lvm_vgscan=${sbindir}/vgscan
|
||||
lvm_lvdisplay=${sbindir}/lvdisplay
|
||||
lvm_lvs=${sbindir}/lvs
|
||||
|
||||
CLVMDOPTS="-T30"
|
||||
|
||||
@ -42,17 +42,12 @@ CLVMDOPTS="-T30"
|
||||
|
||||
LOCK_FILE="/var/lock/subsys/$DAEMON"
|
||||
|
||||
# NOTE: replace this with vgs, once display filter per attr is implemented.
|
||||
clustered_vgs() {
|
||||
${lvm_vgdisplay} 2>/dev/null | \
|
||||
awk 'BEGIN {RS="VG Name"} {if (/Clustered/) print $1;}'
|
||||
${lvm_vgs} --noheadings -o vg_name -S 'vg_clustered=1' 2>/dev/null
|
||||
}
|
||||
|
||||
clustered_active_lvs() {
|
||||
for i in $(clustered_vgs); do
|
||||
${lvm_lvdisplay} $i 2>/dev/null | \
|
||||
awk 'BEGIN {RS="LV Name"} {if (/[^N^O^T] available/) print $1;}'
|
||||
done
|
||||
${lvm_lvs} --noheadings -o lv_name -S 'vg_clustered=1 && lv_active!=""' 2>/dev/null
|
||||
}
|
||||
|
||||
rh_status() {
|
||||
|
@ -7,16 +7,8 @@ lvm_vgscan=${sbindir}/vgscan
|
||||
lvm_vgs=${sbindir}/vgs
|
||||
lvm_lvm=${sbindir}/lvm
|
||||
|
||||
parse_clustered_vgs() {
|
||||
while read -r name attrs;
|
||||
do
|
||||
test "${attrs:5:1}" == 'c' && echo -n "$name "
|
||||
done
|
||||
}
|
||||
|
||||
# NOTE: replace this with vgs, once display filter per attr is implemented.
|
||||
clustered_vgs() {
|
||||
${lvm_vgs} -o vg_name,vg_attr --noheadings | parse_clustered_vgs
|
||||
${lvm_vgs} --noheadings -o vg_name -S 'vg_clustered=1' 2>/dev/null
|
||||
}
|
||||
|
||||
activate() {
|
||||
|
Loading…
Reference in New Issue
Block a user