1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-18 10:04:20 +03:00

Avoid using pipes on lv commands

Failure on pipe kills lv command and produces memory stacktrace.
Add 'true' for empty grep/sed to avoid generating stacktrace.

This should help with long time (7min) for this test on Lenny testing maching
(mimage was filler with stacktrace and each word was used as LV name).
This commit is contained in:
Zdenek Kabelac 2011-03-03 15:46:05 +00:00
parent 8595f0c6ac
commit 6a9646d1ce

View File

@ -24,8 +24,8 @@ lv_is_on_ ()
echo $pvs | sed 's/ /\n/g' | sort | uniq > out1
lvs -a -o+devices $lv
lvs -a -odevices --noheadings $lv | \
sed 's/([^)]*)//g; s/[ ,]/\n/g' | sort | uniq > out2
lvs -a -odevices --noheadings $lv > lvs_log
sed 's/([^)]*)//g; s/[ ,]/\n/g' lvs_log | sort | uniq > out2 || true
diff --ignore-blank-lines out1 out2
}
@ -41,14 +41,15 @@ mimages_are_on_ ()
echo "Check if mirror images of $lv are on PVs $pvs"
rm -f out1 out2
echo $pvs | sed 's/ /\n/g' | sort | uniq > out1
lvs --noheadings -a -o lv_name $vg > lvs_log
mimages=$(grep "${lv}_mimage_" lvs_log | \
sed 's/\[//g; s/\]//g' || true)
mimages=$(lvs --noheadings -a -o lv_name $vg | grep "${lv}_mimage_" | \
sed 's/\[//g; s/\]//g')
for i in $mimages; do
echo "Checking $vg/$i"
lvs -a -o+devices $vg/$i
lvs -a -odevices --noheadings $vg/$i | \
sed 's/([^)]*)//g; s/ //g; s/,/ /g' | sort | uniq >> out2
lvs -a -odevices --noheadings $vg/$i > lvs_log
sed 's/([^)]*)//g; s/ //g; s/,/ /g' lvs_log | sort | uniq >> out2 || true
done
diff --ignore-blank-lines out1 out2