limit the devices for which lvm vgscan will scan
authorHarald Hoyer <harald@redhat.com>
Wed, 15 Jul 2009 07:33:44 +0000 (09:33 +0200)
committerHarald Hoyer <harald@redhat.com>
Wed, 15 Jul 2009 16:27:20 +0000 (18:27 +0200)
Build the filter list and create /etc/lvm/lvm.conf for all LVM_member
devices found by udev.

modules.d/90lvm/lvm_scan.sh

index cd843aa..489c7a1 100755 (executable)
@@ -3,6 +3,25 @@
 if $UDEV_QUEUE_EMPTY >/dev/null 2>&1; then
     [ -h "$job" ] && rm -f "$job"
     # run lvm scan if udev has settled
+
+    [ -d /etc/lvm ] || mkdir -p /etc/lvm
+    # build a list of devices to scan
+    lvmdevs=$(
+       for f in /tmp/.lvm_scan-*; do
+           [ -e "$f" ] || continue
+           echo ${f##/tmp/.lvm_scan-}
+       done
+       )
+    {
+       echo 'devices {';
+       echo -n '    filter = [ '
+       for dev in $lvmdevs; do
+           printf '"a|^/dev/%s$|", ' $dev;
+       done;
+       echo '"r/.*/" ]';
+       echo '}';         
+    } > /etc/lvm/lvm.conf
+
     lvm vgscan
     lvm vgchange -ay
 fi