If boot parameter filter=* is specified, lvm.conf is generated in the
initrd to restrict PV scanning.

e.g. filter=/dev/disk/by-id/scsi-3600c0ff000d791aceb63ff4901000000
would generate lvm.conf with:
devices { filter = [ 
"a|^/dev/disk/by-id/scsi-3600c0ff000d791aceb63ff4901000000|", "r|.*|" ]
}

Parameter is optional, if not present, lvm.conf is not generated and LVM
defaults apply (which is to scan all block devices).

Since optional, this is a low-risk change. Follow-up patch will actualy
modify the installation to apply this parameter in grub.conf.

Related: rhbz#510691

Signed-off-by: Alan Pevec <[email protected]>
Signed-off-by: Michael Burns <[email protected]>
---
 scripts/ovirt-config-boot |   23 ++++++++++++++++++++++-
 1 files changed, 22 insertions(+), 1 deletions(-)

diff --git a/scripts/ovirt-config-boot b/scripts/ovirt-config-boot
index 2961f76..7c5943b 100755
--- a/scripts/ovirt-config-boot
+++ b/scripts/ovirt-config-boot
@@ -108,6 +108,19 @@ ovirt_boot_setup() {
         init_script=sbin/real-init
     fi
     sed -i '/^\/sbin\/udev.*trigger/ a \
+filter=\
+for o in `cat /proc/cmdline` ; do\
+    case $o in\
+    filter=*)\
+        filter=${o#filter=}\
+        ;;\
+    esac\
+done\
+if [ -n "$filter" ]; then\
+  mkdir -p /etc/lvm\
+  echo "devices { filter = [ \\\"a|^$filter|\\\", \\\"r|.*|\\\" ] }" > 
/etc/lvm/lvm.conf\
+fi\
+
 echo SCSI wait for scans\
 /sbin/modprobe scsi_wait_scan\
 /sbin/modprobe -r scsi_wait_scan\
@@ -138,7 +151,15 @@ set -e\
         # lvm is not static in Fedora
         cp /lib$bit/libreadline.so.5 /lib$bit/libncurses.so.5 lib$bit
     fi
-    find $init_script bin/lvm lib$bit -type f |
+    # add udev rules, so we can use /dev/disk/by-id/* in LVM filter
+    rules=etc/udev/rules.d
+    mkdir -p $rules
+    grep -v -E 
'path_id|edd_id|check-cdrom.sh|load_floppy_module.sh|create_floppy_devices' 
/$rules/50-udev.rules > $rules/50-udev.rules
+    lud=lib/udev
+    mkdir -p $lud
+    cp -pv /$lud/ata_id /$lud/scsi_id /$lud/usb_id $lud
+    ln -s /sbin/modprobe $lud
+    find $init_script $scsiwait bin/lvm lib$bit $rules $lud -type f -o -type l 
|
         cpio -H newc --quiet -o |
         gzip -9 |
         cat $live/$syslinux/initrd0.img - > /boot/initrd0.img
-- 
1.6.2.5

_______________________________________________
Ovirt-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/ovirt-devel

Reply via email to