From aa4fdaef4a50c1113f34a38e869e9238f80d03ca Mon Sep 17 00:00:00 2001 From: Alan Pevec Date: Tue, 22 Dec 2009 22:44:17 +0100 Subject: [PATCH] mayflower: add lvm and multipath to livecd initrd This was previously added by ovirt-config-boot during install to disk, but in order to support upgrades from boot media, multipath needs to be started early. Signed-off-by: Alan Pevec --- tools/mayflower | 69 ++++++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 56 insertions(+), 13 deletions(-) diff --git a/tools/mayflower b/tools/mayflower index 698e9b5..99b3eaa 100755 --- a/tools/mayflower +++ b/tools/mayflower @@ -194,6 +194,19 @@ cp /bin/grep bin cp /bin/dmesg bin cp /sbin/lsmod sbin +# lvm and multipath +[ -e /sbin/lvm ] && cp /sbin/lvm sbin +[ -e /sbin/multipath ] && cp /sbin/multipath sbin +[ -e /sbin/scsi_id ] && cp /sbin/scsi_id sbin +[ -e /sbin/kpartx ] && cp /sbin/kpartx sbin +prio=/sbin/mpath_prio_ +for M in alua emc hds_modular hp_sw intel netapp ontap rdac tpc weighted; do + cp $prio$M sbin +done +# default config for HP MSA2[02]12fc|MSA2012i +# prio_callout /bin/true +cp /bin/true bin + # if we have the iso checker, we want it [ -x /usr/lib/anaconda-runtime/checkisomd5 ] && cp /usr/lib/anaconda-runtime/checkisomd5 bin [ -x /usr/bin/checkisomd5 ] && cp /usr/bin/checkisomd5 bin @@ -215,6 +228,16 @@ switchroot EOF chmod 755 sbin/run-init +cat > sbin/scsi-wait <<'EOF' +#!/sbin/nash +stabilized --hash --interval 1000 /proc/scsi/scsi +EOF +chmod 755 sbin/scsi-wait + +mkdir -p etc/lvm +echo 'devices { preferred_names = [ "^/dev/mpath/", "^/dev/mapper/", "^/dev/[hs]d" ] }' > etc/lvm/lvm.conf +cat /dev/null > etc/multipath.conf + # Write out init cat > init <<'EOF' #!/bin/bash @@ -223,7 +246,7 @@ emergency_shell() { echo "Bug in initramfs /init detected. Dropping to a shell. Good luck!" echo - bash + bash < /dev/console } trap "emergency_shell" 0 2 @@ -235,9 +258,9 @@ export PATH=/sbin:/bin exec < /dev/console > /dev/console 2>&1 mount -n -t tmpfs -o mode=0755 udev /dev -mknod /dev/console c 5 1 -mknod /dev/null c 1 3 -mknod /dev/kmsg c 1 11 +mknod /dev/console c 5 1 || : +mknod /dev/null c 1 3 || : +mknod /dev/kmsg c 1 11 || : mkdir /dev/pts mkdir -m 1777 /dev/shm ln -s /proc/self/fd /dev/fd @@ -478,11 +501,31 @@ if [ "$quiet" != "1" ] ; then fi /sbin/udevsettle --timeout=30 || : +echo SCSI wait +scsi-wait +modprobe dm_mod || : +modprobe dm_multipath || : +multipath -v3 +dmsetup ls --target multipath --exec "kpartx -a -p p" +# RHEV-H specific rootfs +if echo $root | grep -q HostVG; then + set +e + while true; do + echo Scanning logical volumes + lvm vgscan --ignorelockingfailure + echo Activating logical volumes + if lvm vgchange -ay --ignorelockingfailure HostVG; then + break + fi + sleep 1 + done + set -e +fi if [ "$shell" == "1" ] ; then echo "Shell requested on kernel commandline. Exit to continue booting." echo - bash + bash < /dev/console fi # don't wait for "mtd0" as no device file will appear @@ -500,7 +543,7 @@ if [ "$root" != "mtd0" -a ! -f "$thingtomount" ] ; then echo "Create symlink /dev/root and then exit this shell to continue" echo "the boot sequence." echo - bash + bash < /dev/console fi fi @@ -533,7 +576,7 @@ if [ "$root" != "mtd0" -a ! -f "$thingtomount" ] ; then echo "Create symlink /dev/root and then exit this shell to continue" echo "the boot sequence." echo - bash + bash < /dev/console fi if [ "$quiet" != "1" ] ; then @@ -594,7 +637,7 @@ if [ "$RES" != "0" ] ; then echo "Dropping to a shell. " echo "Mount rootfs at /sysroot and exit shell to continue. Good luck!" echo - bash + bash < /dev/console fi # Now get ready to leave the initramfs @@ -702,7 +745,7 @@ if [ -n "$EXT3FS" ] ; then fi mkdir -p /dev/mapper - mknod /dev/mapper/control c 10 63 + mknod /dev/mapper/control c 10 63 || : modprobe dm_snapshot BASE_LOOPDEV=$( losetup -f ) @@ -725,7 +768,7 @@ if [ -e "$SQUASHED" ] ; then fi mkdir -p /dev/mapper - mknod /dev/mapper/control c 10 63 + mknod /dev/mapper/control c 10 63 || : modprobe dm_snapshot if [ "$live_ram" == "1" ] ; then @@ -764,7 +807,7 @@ if [ "$eshell" == "1" ] ; then echo "Shell requested on kernel commandline." echo "Rootfs is mounted ro on /sysroot. Exit to continue booting." echo - bash + bash < /dev/console fi if [ -x /sysroot$init ] ; then @@ -782,7 +825,7 @@ if [ -x /sysroot$init ] ; then echo echo "Dropping to a shell. Good luck!" echo - bash + bash < /dev/console else echo "---------------------------------------------------------" echo "WARNING: Requested $init binary does not exist on rootfs." @@ -790,7 +833,7 @@ else echo echo "Dropping to a shell. Good luck!" echo - bash + bash < /dev/console fi EOF -- 2.11.4.GIT