Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Multipath and boot on SAN with genkernel !
View unanswered posts
View posts from last 24 hours

Goto page 1, 2  Next  
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
dulrich
n00b
n00b


Joined: 23 Apr 2005
Posts: 46

PostPosted: Thu Nov 13, 2008 2:43 pm    Post subject: Multipath and boot on SAN with genkernel ! Reply with quote

Hi all,

I have worked to boot a gentoo from a SAN with multipath activated at boot time. After spending some time on genkernel I get it work!

Here are the modification I have made on /usr/shar/genkernel to create an initramfs with multipath-tools :
Code:
diff -r /usr/share/genkernel/gen_cmdline.sh genkernel/gen_cmdline.sh
86d85
<   echo "   --multipath      Include MULTIPATH support"
263,272d261
<       --multipath)
<          if [ ! -e /usr/include/libdevmapper.h ]
<          then
<             echo 'Error: --multipath requires device-mapper to be installed'
<             echo '       on the host system; try "emerge device-mapper".'
<             exit 1
<          fi
<          CMD_MULTIPATH=1
<          print_info 2 "CMD_MULTIPATH: ${CMD_MULTIPATH}"
<          ;;
diff -r /usr/share/genkernel/gen_configkernel.sh genkernel/gen_configkernel.sh
115,121d114
<    if isTrue ${CMD_MULTIPATH}
<    then
<       sed -i ${KERNEL_DIR}/.config -e 's/#\? \?CONFIG_BLK_DEV_DM is.*/CONFIG_BLK_DEV_DM=m/g'
<       sed -i ${KERNEL_DIR}/.config -e 's/#\? \?CONFIG_DM_MULTIPATH is.*/CONFIG_DM_MULTIPATH=m/g'
<       sed -i ${KERNEL_DIR}/.config -e 's/#\? \?CONFIG_DM_MULTIPATH_RDAC is.*/CONFIG_DM_MULTIPATH_RDAC=m/g'
<    fi
<
diff -r /usr/share/genkernel/gen_determineargs.sh genkernel/gen_determineargs.sh
112d111
<    set_config_with_override 1 MULTIPATH            CMD_MULTIPATH
133d131
<    MULTIPATH_BINCACHE=`cache_replace "${MULTIPATH_BINCACHE}"`
142d139
<    MULTIPATH_BINCACHE=`arch_replace "${MULTIPATH_BINCACHE}"`
diff -r /usr/share/genkernel/gen_funcs.sh genkernel/gen_funcs.sh
519c519
<    for i in $BUSYBOX_SRCTAR $DEVICE_MAPPER_SRCTAR $LVM_SRCTAR $MULTIPATH_SRCTAR $DMRAID_SRCTAR $E2FSPROGS_SRCTAR
---
>    for i in $BUSYBOX_SRCTAR $DEVICE_MAPPER_SRCTAR $LVM_SRCTAR $DMRAID_SRCTAR $E2FSPROGS_SRCTAR
diff -r /usr/share/genkernel/gen_initramfs.sh genkernel/gen_initramfs.sh
115,163d114
< append_multipath(){
<    if [ -d "${TEMP}/initramfs-multipath-temp" ]
<    then
<       rm -r "${TEMP}/initramfs-multipath-temp/"
<    fi
<    print_info 1 '      MULTIPATH: Adding support...'
<    mkdir -p "${TEMP}/initramfs-multipath-temp/bin/"
<    mkdir -p "${TEMP}/initramfs-multipath-temp/etc/"
<    mkdir -p "${TEMP}/initramfs-multipath-temp/sbin/"
<    mkdir -p ${TEMP}/initramfs-multipath-temp/lib
<    cp -a /lib/ld-* "${TEMP}/initramfs-multipath-temp/lib" \
<       || gen_die 'Could not copy files for MULTIPATH!'
<    cp -a /lib/libc-* /lib/libc.* "${TEMP}/initramfs-multipath-temp/lib" \
<       || gen_die 'Could not copy files for MULTIPATH!'
<    cp -a /lib/libdl-* /lib/libdl.* "${TEMP}/initramfs-multipath-temp/lib" \
<       || gen_die 'Could not copy files for EVMS!'
<    cp -a /lib/libsysfs*so* "${TEMP}/initramfs-multipath-temp/lib" \
<       || gen_die 'Could not copy files for MULTIPATH!'
<    cp -a /lib/libdevmapper*so* "${TEMP}/initramfs-multipath-temp/lib" \
<       || gen_die 'Could not copy files for MULTIPATH!'
<    cp -a /sbin/multipath "${TEMP}/initramfs-multipath-temp/sbin" \
<       || gen_die 'Could not copy files for MULTIPATH!'
<    cp -a /sbin/kpartx "${TEMP}/initramfs-multipath-temp/sbin" \
<       || gen_die 'Could not copy files for MULTIPATH!'
<    cp -a /sbin/mpath_prio_* "${TEMP}/initramfs-multipath-temp/sbin" \
<       || gen_die 'Could not copy files for MULTIPATH!'
<    cp -a /lib64/udev/scsi_id "${TEMP}/initramfs-multipath-temp/sbin" \
<       || gen_die 'Could not copy files for MULTIPATH!'
<    cp -a /sbin/devmap_name "${TEMP}/initramfs-multipath-temp/sbin" \
<       || gen_die 'Could not copy files for MULTIPATH!'
<    cp -a /sbin/dmsetup "${TEMP}/initramfs-multipath-temp/sbin" \
<       || gen_die 'Could not copy files for MULTIPATH!'
<    cp -a /bin/mountpoint "${TEMP}/initramfs-multipath-temp/bin" \
<       || gen_die 'Could not copy files for MULTIPATH!'
<    if [ -x /sbin/multipath ]
<    then
<       cp /etc/multipath.conf "${TEMP}/initramfs-multipath-temp/etc/" ||
<          gen_die 'Could not copy over multipath.conf!'
<    fi
<    if [ -x /sbin/scsi_id ]
<    then
<       cp /etc/scsi_id.config "${TEMP}/initramfs-multipath-temp/etc/" ||
<          gen_die 'Could not copy over multipath.conf!'
<    fi
<    cd "${TEMP}/initramfs-multipath-temp/"
<    find . -print | cpio ${CPIO_ARGS} --append -F "${CPIO}"
<    rm -r "${TEMP}/initramfs-multipath-temp/"
< }
<
517d467
<    append_data 'multipath' "${MULTIPATH}"
diff -r /usr/share/genkernel/gen_initrd.sh genkernel/gen_initrd.sh
112,153d111
<
<         if [ "${MULTIPATH}" -eq '1' ]
<         then
<                 print_info 1 '          MULTIPATH: Adding support...'
<                 mkdir -p ${TEMP}/initrd-temp/bin
<                 mkdir -p ${TEMP}/initrd-temp/etc
<                 mkdir -p ${TEMP}/initrd-temp/lib
<                 mkdir -p ${TEMP}/initrd-temp/sbin
<                 cp -a /lib/ld-* "${TEMP}/initrd-temp/lib" \
<                         || gen_die 'Could not copy files for MULTIPATH!'
<                 cp -a /lib/libc-* /lib/libc.* "${TEMP}/initrd-temp/lib" \
<                         || gen_die 'Could not copy files for MULTIPATH!'
<                 cp -a /lib/libdl-* /lib/libdl.* "${TEMP}/initrd-temp/lib" \
<                         || gen_die 'Could not copy files for EVMS!'
<                 cp -a /lib/libsysfs*so* "${TEMP}/initrd-temp/lib" \
<                         || gen_die 'Could not copy files for MULTIPATH!'
<                 cp -a /lib/libdevmapper*so* "${TEMP}/initrd-temp/lib" \
<                         || gen_die 'Could not copy files for MULTIPATH!'
<                 cp -a /sbin/multipath "${TEMP}/initrd-temp/sbin" \
<                         || gen_die 'Could not copy files for MULTIPATH!'
<                 cp -a /sbin/kpartx "${TEMP}/initrd-temp/sbin" \
<                         || gen_die 'Could not copy files for MULTIPATH!'
<                 cp -a /sbin/mpath_prio_* "${TEMP}/initrd-temp/sbin" \
<                         || gen_die 'Could not copy files for MULTIPATH!'
<            cp -a /lib64/udev/scsi_id "${TEMP}/initrd-temp/sbin" \
<                    || gen_die 'Could not copy files for MULTIPATH!'
<                 cp -a /sbin/devmap_name "${TEMP}/initrd-temp/sbin" \
<                         || gen_die 'Could not copy files for MULTIPATH!'
<                 cp -a /bin/mountpoint "${TEMP}/initrd-temp/bin" \
<                         || gen_die 'Could not copy files for MULTIPATH!'
<            if [ -x /sbin/multipath ]
<              then
<                    cp /etc/multipath.conf "${TEMP}/initrd-temp/etc/" ||
<                            gen_die 'Could not copy over multipath.conf!'
<            fi
<              if [ -x /sbin/scsi_id ]
<            then
<                    cp /etc/scsi_id.config "${TEMP}/initramfs-multipath-temp/etc/" ||
<                            gen_die 'Could not copy over multipath.conf!'
<            fi
<         fi
<
diff -r /usr/share/genkernel/generic/initrd.scripts genkernel/generic/initrd.scripts
659,667d658
<    
<    if [ "${USE_MULTIPATH_NORMAL}" = '1' ]
<    then
<             good_msg "Scanning for multipath devices"
<            /sbin/multipath
<       sleep 2
<             good_msg "Activating multipath devices"
<       /sbin/dmsetup ls --target multipath --exec "/sbin/kpartx -a"
<    fi
diff -r /usr/share/genkernel/generic/linuxrc genkernel/generic/linuxrc
102,105d101
<       domultipath)
<          good_msg "Booting with multipath activated."
<          USE_MULTIPATH_NORMAL=1
<       ;;
diff -r /usr/share/genkernel/x86_64/modules_load genkernel/x86_64/modules_load
9d8
< MODULES_MULTIPATH="dm-mod dm-multipath dm-round-robin dm-rdac"


I have started to add a "compiled" multipath but finally I have just used copy of binary and libs. Of course It's possible to spend more time to have it with static compiled libraries.

I hope this will help to have multipath support in genkernel !

Now I can dynamically switch the paths of my system volume and boot from it.

To boot you have to add to grub/menu.lst the option "domultipath" on the initramfs line.

To create the initramfs just do an :
genkernel --multipath --firmware --no-clean initrd

(--firmware is for adding qla2xxx firmware for my hardware which is IBM HS20 with qla2 and DS4300).

There is some work to do to add multipathd service start at boot level (adding it in initramfs)... and I have some test to do booting on different path.
Back to top
View user's profile Send private message
dulrich
n00b
n00b


Joined: 23 Apr 2005
Posts: 46

PostPosted: Thu Nov 20, 2008 10:03 pm    Post subject: Reply with quote

This was for genkernel 3.4.10-r1

In the different test I have made :
- I can boot on the 2 paths I have on my SAN (I test to remove pathA before booting, it boots on pathB correctly). This is not possible with LSI rdac driver :) !!
- Multipath switch correctly over the paths when a path goes down.

But (there is always a "but" :D ) :
- I need to use wwid and alias in multipath.conf for "hard" mapping the volumes. If I don't use the alias the name are mpath0 on boot time and mpath1 after initramfs give the hand to kernel... So it's not very easy to use... I need to search a solution for this problem. Because on a bladecenter, when I move the volume to another Blade, the volumes change his wwid...

Here is a more usable patch :
Code:
diff -ur /home/dulrich/genkernel/gen_cmdline.sh genkernel/gen_cmdline.sh
--- /home/dulrich/genkernel/gen_cmdline.sh   2008-10-24 11:16:36.000000000 +0200
+++ genkernel/gen_cmdline.sh   2008-11-13 10:40:34.000000000 +0100
@@ -83,6 +83,7 @@
   echo "   --lvm2         Include LVM support"
   echo "   --mdadm         Copy /etc/mdadm.conf to initramfs"
   echo "   --dmraid      Include DMRAID support"
+  echo "   --multipath      Include MULTIPATH support"
   echo "   --slowusb      Enables extra pauses for slow USB CD boots"
   echo "   --bootloader=grub   Add new kernel to GRUB configuration"
   echo "   --linuxrc=<file>   Specifies a user created linuxrc"
@@ -259,6 +260,16 @@
          CMD_DMRAID=1
          print_info 2 "CMD_DMRAID: ${CMD_DMRAID}"
          ;;
+      --multipath)
+         if [ ! -e /usr/include/libdevmapper.h ]
+         then
+            echo 'Error: --multipath requires device-mapper to be installed'
+            echo '       on the host system; try "emerge device-mapper".'
+            exit 1
+         fi
+         CMD_MULTIPATH=1
+         print_info 2 "CMD_MULTIPATH: ${CMD_MULTIPATH}"
+         ;;
       --bootloader=*)
          CMD_BOOTLOADER=`parse_opt "$*"`
          print_info 2 "CMD_BOOTLOADER: ${CMD_BOOTLOADER}"
diff -ur /home/dulrich/genkernel/gen_configkernel.sh genkernel/gen_configkernel.sh
--- /home/dulrich/genkernel/gen_configkernel.sh   2008-10-24 11:16:36.000000000 +0200
+++ genkernel/gen_configkernel.sh   2008-11-13 10:43:07.000000000 +0100
@@ -112,6 +112,13 @@
       sed -i ${KERNEL_DIR}/.config -e 's/#\? \?CONFIG_BLK_DEV_DM is.*/CONFIG_BLK_DEV_DM=m/g'
    fi
 
+   if isTrue ${CMD_MULTIPATH}
+   then
+      sed -i ${KERNEL_DIR}/.config -e 's/#\? \?CONFIG_BLK_DEV_DM is.*/CONFIG_BLK_DEV_DM=m/g'
+      sed -i ${KERNEL_DIR}/.config -e 's/#\? \?CONFIG_DM_MULTIPATH is.*/CONFIG_DM_MULTIPATH=m/g'
+      sed -i ${KERNEL_DIR}/.config -e 's/#\? \?CONFIG_DM_MULTIPATH_RDAC is.*/CONFIG_DM_MULTIPATH_RDAC=m/g'
+   fi
+
    if isTrue ${SPLASH}
    then
       sed -i ${KERNEL_DIR}/.config -e 's/#\? \?CONFIG_FB_SPLASH is.*/CONFIG_FB_SPLASH=y/g'
diff -ur /home/dulrich/genkernel/gen_determineargs.sh genkernel/gen_determineargs.sh
--- /home/dulrich/genkernel/gen_determineargs.sh   2008-10-24 11:16:36.000000000 +0200
+++ genkernel/gen_determineargs.sh   2008-11-13 10:44:34.000000000 +0100
@@ -109,6 +109,7 @@
    set_config_with_override 1 LVM                  CMD_LVM
    set_config_with_override 1 EVMS                 CMD_EVMS
    set_config_with_override 1 DMRAID               CMD_DMRAID
+   set_config_with_override 1 MULTIPATH            CMD_MULTIPATH
    set_config_with_override 1 BUSYBOX              CMD_BUSYBOX              "yes"
    set_config_with_override 1 DISKLABEL            CMD_DISKLABEL
    set_config_with_override 1 LUKS                 CMD_LUKS
@@ -129,6 +130,7 @@
    DEVICE_MAPPER_BINCACHE=`cache_replace "${DEVICE_MAPPER_BINCACHE}"`
    LVM_BINCACHE=`cache_replace "${LVM_BINCACHE}"`
    DMRAID_BINCACHE=`cache_replace "${DMRAID_BINCACHE}"`
+   MULTIPATH_BINCACHE=`cache_replace "${MULTIPATH_BINCACHE}"`
    BLKID_BINCACHE=`cache_replace "${BLKID_BINCACHE}"`
   
    DEFAULT_KERNEL_CONFIG=`arch_replace "${DEFAULT_KERNEL_CONFIG}"`
@@ -137,6 +139,7 @@
    DEVICE_MAPPER_BINCACHE=`arch_replace "${DEVICE_MAPPER_BINCACHE}"`
    LVM_BINCACHE=`arch_replace "${LVM_BINCACHE}"`
    DMRAID_BINCACHE=`arch_replace "${DMRAID_BINCACHE}"`
+   MULTIPATH_BINCACHE=`arch_replace "${MULTIPATH_BINCACHE}"`
    BLKID_BINCACHE=`arch_replace "${BLKID_BINCACHE}"`
    
 
diff -ur /home/dulrich/genkernel/gen_funcs.sh genkernel/gen_funcs.sh
--- /home/dulrich/genkernel/gen_funcs.sh   2008-10-24 11:16:36.000000000 +0200
+++ genkernel/gen_funcs.sh   2008-11-13 10:26:30.000000000 +0100
@@ -516,7 +516,7 @@
 }
 
 check_distfiles() {
-   for i in $BUSYBOX_SRCTAR $DEVICE_MAPPER_SRCTAR $LVM_SRCTAR $DMRAID_SRCTAR $E2FSPROGS_SRCTAR
+   for i in $BUSYBOX_SRCTAR $DEVICE_MAPPER_SRCTAR $LVM_SRCTAR $MULTIPATH_SRCTAR $DMRAID_SRCTAR $E2FSPROGS_SRCTAR
    do
       if [ ! -f "${i}" ]
       then
diff -ur /home/dulrich/genkernel/gen_initramfs.sh genkernel/gen_initramfs.sh
--- /home/dulrich/genkernel/gen_initramfs.sh   2008-10-24 11:16:36.000000000 +0200
+++ genkernel/gen_initramfs.sh   2008-11-13 13:42:02.000000000 +0100
@@ -112,6 +112,55 @@
    rm -r "${TEMP}/initramfs-dmraid-temp/"
 }
 
+append_multipath(){
+   if [ -d "${TEMP}/initramfs-multipath-temp" ]
+   then
+      rm -r "${TEMP}/initramfs-multipath-temp/"
+   fi
+   print_info 1 '      MULTIPATH: Adding support...'
+   mkdir -p "${TEMP}/initramfs-multipath-temp/bin/"
+   mkdir -p "${TEMP}/initramfs-multipath-temp/etc/"
+   mkdir -p "${TEMP}/initramfs-multipath-temp/sbin/"
+   mkdir -p ${TEMP}/initramfs-multipath-temp/lib
+   cp -a /lib/ld-* "${TEMP}/initramfs-multipath-temp/lib" \
+      || gen_die 'Could not copy files for MULTIPATH!'
+   cp -a /lib/libc-* /lib/libc.* "${TEMP}/initramfs-multipath-temp/lib" \
+      || gen_die 'Could not copy files for MULTIPATH!'
+   cp -a /lib/libdl-* /lib/libdl.* "${TEMP}/initramfs-multipath-temp/lib" \
+      || gen_die 'Could not copy files for EVMS!'
+   cp -a /lib/libsysfs*so* "${TEMP}/initramfs-multipath-temp/lib" \
+      || gen_die 'Could not copy files for MULTIPATH!'
+   cp -a /lib/libdevmapper*so* "${TEMP}/initramfs-multipath-temp/lib" \
+      || gen_die 'Could not copy files for MULTIPATH!'
+   cp -a /sbin/multipath "${TEMP}/initramfs-multipath-temp/sbin" \
+      || gen_die 'Could not copy files for MULTIPATH!'
+   cp -a /sbin/kpartx "${TEMP}/initramfs-multipath-temp/sbin" \
+      || gen_die 'Could not copy files for MULTIPATH!'
+   cp -a /sbin/mpath_prio_* "${TEMP}/initramfs-multipath-temp/sbin" \
+      || gen_die 'Could not copy files for MULTIPATH!'
+   cp -a /lib64/udev/scsi_id "${TEMP}/initramfs-multipath-temp/sbin" \
+      || gen_die 'Could not copy files for MULTIPATH!'
+   cp -a /sbin/devmap_name "${TEMP}/initramfs-multipath-temp/sbin" \
+      || gen_die 'Could not copy files for MULTIPATH!'
+   cp -a /sbin/dmsetup "${TEMP}/initramfs-multipath-temp/sbin" \
+      || gen_die 'Could not copy files for MULTIPATH!'
+   cp -a /bin/mountpoint "${TEMP}/initramfs-multipath-temp/bin" \
+      || gen_die 'Could not copy files for MULTIPATH!'
+   if [ -x /sbin/multipath ]
+   then
+      cp /etc/multipath.conf "${TEMP}/initramfs-multipath-temp/etc/" ||
+         gen_die 'Could not copy over multipath.conf!'
+   fi
+   if [ -x /sbin/scsi_id ]
+   then
+      cp /etc/scsi_id.config "${TEMP}/initramfs-multipath-temp/etc/" ||
+         gen_die 'Could not copy over multipath.conf!'
+   fi
+   cd "${TEMP}/initramfs-multipath-temp/"
+   find . -print | cpio ${CPIO_ARGS} --append -F "${CPIO}"
+   rm -r "${TEMP}/initramfs-multipath-temp/"
+}
+
 append_lvm(){
    if [ -d "${TEMP}/initramfs-lvm-temp" ]
    then
@@ -465,6 +514,7 @@
    append_data 'busybox' "${BUSYBOX}"
    append_data 'lvm' "${LVM}"
    append_data 'dmraid' "${DMRAID}"
+   append_data 'multipath' "${MULTIPATH}"
    append_data 'evms' "${EVMS}"
    append_data 'mdadm' "${MDADM}"
    
diff -ur /home/dulrich/genkernel/gen_initrd.sh genkernel/gen_initrd.sh
--- /home/dulrich/genkernel/gen_initrd.sh   2008-10-24 11:16:36.000000000 +0200
+++ genkernel/gen_initrd.sh   2008-11-13 15:36:00.000000000 +0100
@@ -109,6 +109,48 @@
 #         fi
       fi
    fi
+
+        if [ "${MULTIPATH}" -eq '1' ]
+        then
+                print_info 1 '          MULTIPATH: Adding support...'
+                mkdir -p ${TEMP}/initrd-temp/bin
+                mkdir -p ${TEMP}/initrd-temp/etc
+                mkdir -p ${TEMP}/initrd-temp/lib
+                mkdir -p ${TEMP}/initrd-temp/sbin
+                cp -a /lib/ld-* "${TEMP}/initrd-temp/lib" \
+                        || gen_die 'Could not copy files for MULTIPATH!'
+                cp -a /lib/libc-* /lib/libc.* "${TEMP}/initrd-temp/lib" \
+                        || gen_die 'Could not copy files for MULTIPATH!'
+                cp -a /lib/libdl-* /lib/libdl.* "${TEMP}/initrd-temp/lib" \
+                        || gen_die 'Could not copy files for EVMS!'
+                cp -a /lib/libsysfs*so* "${TEMP}/initrd-temp/lib" \
+                        || gen_die 'Could not copy files for MULTIPATH!'
+                cp -a /lib/libdevmapper*so* "${TEMP}/initrd-temp/lib" \
+                        || gen_die 'Could not copy files for MULTIPATH!'
+                cp -a /sbin/multipath "${TEMP}/initrd-temp/sbin" \
+                        || gen_die 'Could not copy files for MULTIPATH!'
+                cp -a /sbin/kpartx "${TEMP}/initrd-temp/sbin" \
+                        || gen_die 'Could not copy files for MULTIPATH!'
+                cp -a /sbin/mpath_prio_* "${TEMP}/initrd-temp/sbin" \
+                        || gen_die 'Could not copy files for MULTIPATH!'
+           cp -a /lib64/udev/scsi_id "${TEMP}/initrd-temp/sbin" \
+                   || gen_die 'Could not copy files for MULTIPATH!'
+                cp -a /sbin/devmap_name "${TEMP}/initrd-temp/sbin" \
+                        || gen_die 'Could not copy files for MULTIPATH!'
+                cp -a /bin/mountpoint "${TEMP}/initrd-temp/bin" \
+                        || gen_die 'Could not copy files for MULTIPATH!'
+           if [ -x /sbin/multipath ]
+             then
+                   cp /etc/multipath.conf "${TEMP}/initrd-temp/etc/" ||
+                           gen_die 'Could not copy over multipath.conf!'
+           fi
+             if [ -x /sbin/scsi_id ]
+           then
+                   cp /etc/scsi_id.config "${TEMP}/initramfs-multipath-temp/etc/" ||
+                           gen_die 'Could not copy over multipath.conf!'
+           fi
+        fi
+
    
    # EVMS
    if [ "${EVMS}" -eq '1' ]
diff -ur /home/dulrich/genkernel/generic/initrd.scripts genkernel/generic/initrd.scripts
--- /home/dulrich/genkernel/generic/initrd.scripts   2008-10-24 11:16:36.000000000 +0200
+++ genkernel/generic/initrd.scripts   2008-11-13 15:33:54.000000000 +0100
@@ -656,6 +656,15 @@
          bad_msg "vgscan or vgchange not found: skipping LVM volume group activation!"
       fi
    fi
+   
+   if [ "${USE_MULTIPATH_NORMAL}" = '1' ]
+   then
+            good_msg "Scanning for multipath devices"
+           /sbin/multipath
+      sleep 2
+            good_msg "Activating multipath devices"
+      /sbin/dmsetup ls --target multipath --exec "/sbin/kpartx -a"
+   fi
 
    if [ "${USE_EVMS_NORMAL}" = '1' ]
    then
diff -ur /home/dulrich/genkernel/generic/linuxrc genkernel/generic/linuxrc
--- /home/dulrich/genkernel/generic/linuxrc   2008-10-24 11:16:36.000000000 +0200
+++ genkernel/generic/linuxrc   2008-11-13 10:46:03.000000000 +0100
@@ -99,6 +99,10 @@
          DMRAID_OPTS=`parse_opt "${x}"`
          USE_DMRAID_NORMAL=1
       ;;
+      domultipath)
+         good_msg "Booting with multipath activated."
+         USE_MULTIPATH_NORMAL=1
+      ;;
       doevms)
          USE_EVMS_NORMAL=1
       ;;
diff -ur /home/dulrich/genkernel/x86_64/modules_load genkernel/x86_64/modules_load
--- /home/dulrich/genkernel/x86_64/modules_load   2008-10-24 11:16:37.000000000 +0200
+++ genkernel/x86_64/modules_load   2008-11-13 10:50:31.000000000 +0100
@@ -6,6 +6,7 @@
 MODULES_EVMS="dm-mod dm-snapshot dm-mirror dm-bbr raid0 raid1 raid456 raid5 raid6 raid10"
 MODULES_LVM="dm-mod dm-snapshot dm-mirror dm-bbr"
 MODULES_MDADM="dm-mod dm-snapshot dm-mirror dm-bbr raid0 raid1 raid456 raid5 raid6 raid10"
+MODULES_MULTIPATH="dm-mod dm-multipath dm-round-robin dm-rdac"
 
 # Hardware (IDE/SCSI/SATA)
 MODULES_PATA="pata_mpiix pata_pdc2027x pata_radisys pata_sil680 pata_rz1000 pata_efar pata_cmd64x pata_hpt366 pata_hpt37x pata_hpt3x3 pata_hpt3x2n pata_optidma pata_it821x pata_artop pata_oldpiix pata_cypress pata_platform pata_serverworks pata_legacy pata_ns87410 pata_ns87415 pata_pcmcia pata_isapnp pata_it8213 pata_ali pata_amd pata_opti pata_atiixp pata_triflex pata_pdc202xx_old pata_sc1200 pata_qdi pata_netcell pata_sis pata_hpt3x2n pata_marvell pata_jmicron pata_via pata_cs5520 pata_cs5530 pata_cs5535 pata_sl82c105 libata scsi_wait_scan"
Back to top
View user's profile Send private message
VinzC
Watchman
Watchman


Joined: 17 Apr 2004
Posts: 5098
Location: Dark side of the mood

PostPosted: Fri Nov 21, 2008 9:30 am    Post subject: Reply with quote

Great work!

EDIT: Comment removed... Didn't read enough :D ...

Trying to understand your problem: do you mean you're required to generate the initrd whenever you move volumes across blades? If so, in what is it annoying? This is like changing your hardware somehow. Hence the need to recompile the initrd seems logical to me. Was that your point?
_________________
Gentoo addict: tomorrow I quit, I promise!... Just one more emerge...
1739!
Back to top
View user's profile Send private message
quantumsummers
Retired Dev
Retired Dev


Joined: 24 Sep 2006
Posts: 103
Location: Earth

PostPosted: Fri Nov 21, 2008 6:34 pm    Post subject: Reply with quote

Just an fyi, we have a nice multipathing doc available at the following url.
http://www.gentoo.org/doc/en/multipath.xml

This is really interesting stuff for diskless machines, keep it up & let us know how things are going!

Cheers,
quantumsummers
_________________
Summers

"...there are no rules here -- we're trying to accomplish something."
- Thomas A. Edison
Back to top
View user's profile Send private message
VinzC
Watchman
Watchman


Joined: 17 Apr 2004
Posts: 5098
Location: Dark side of the mood

PostPosted: Sat Nov 22, 2008 12:39 pm    Post subject: Reply with quote

:lol: I wish I had seen that documentation 2 years ago... I spent weeks trying to figure out how to get those WWID from SAN devices! Actually scsi_id did the trick. Great to have an official Gentoo documentation on that matter.

Thanks a whole lot, man.
_________________
Gentoo addict: tomorrow I quit, I promise!... Just one more emerge...
1739!
Back to top
View user's profile Send private message
dulrich
n00b
n00b


Joined: 23 Apr 2005
Posts: 46

PostPosted: Sat Nov 29, 2008 11:24 pm    Post subject: Reply with quote

quantumsummers wrote:
Just an fyi, we have a nice multipathing doc available at the following url.
http://www.gentoo.org/doc/en/multipath.xml

This is really interesting stuff for diskless machines, keep it up & let us know how things are going!

Cheers,
quantumsummers


Hi,

Yes the doc is good for beginning but it doesn't provide a solution for boot on SAN with multipath.
In this How to there is some "errors" like the daemon :
It s' not
Code:
/etc/init.d/multipath start
but
Code:
/etc/init.d/multipathd start


Instead of sg3_utils, scsi_id does the thing with :
Code:
/sbin/scsi_id -g -u -d /dev/%n


I tried to contact genkernel developers by email (2 last of them) to add this feature but I didn't receive any response. :(
Back to top
View user's profile Send private message
dulrich
n00b
n00b


Joined: 23 Apr 2005
Posts: 46

PostPosted: Sat Nov 29, 2008 11:28 pm    Post subject: Reply with quote

VinzC wrote:
Great work!

EDIT: Comment removed... Didn't read enough :D ...

Trying to understand your problem: do you mean you're required to generate the initrd whenever you move volumes across blades? If so, in what is it annoying? This is like changing your hardware somehow. Hence the need to recompile the initrd seems logical to me. Was that your point?


Exactly ! When I move a volume to another blade the wwid changes. So it's quite annoying because it's my boot volumes. So I have to specify my new real root at boot time for initramfs then I need to specify my new fstab by hand... and finally modify multipath.conf and "recompile" initramfs.

Perharps it's possible to do a script which is run in initramfs to automatically modify the multipath.conf... but it's more complicated if their is more than 1 volume...
Back to top
View user's profile Send private message
VinzC
Watchman
Watchman


Joined: 17 Apr 2004
Posts: 5098
Location: Dark side of the mood

PostPosted: Sun Nov 30, 2008 11:31 am    Post subject: Reply with quote

As far as fstab is concerned, you can as well try mounting using disk labels or UUID's. But then I think this would involve tweaking udev rules a little so that /dev/disk/by-{id,label,path,uuid} nodes are symlinks to multipath'ed nodes.
_________________
Gentoo addict: tomorrow I quit, I promise!... Just one more emerge...
1739!
Back to top
View user's profile Send private message
IlGab
Guru
Guru


Joined: 26 Nov 2004
Posts: 486

PostPosted: Wed Feb 18, 2009 8:55 pm    Post subject: Reply with quote

Your patch is very usefull ! Great job.
Anyway IMHO the multipath script into initrd.scripts must be executed before the LVM, because if you have a logical volume on your storage is better to create the multipath device and then create the logical volume over the disk.

Edit: I successfully boot my SUN fire v210 from a clariion CX400 using multipath ! Many thx for this script.
Back to top
View user's profile Send private message
dulrich
n00b
n00b


Joined: 23 Apr 2005
Posts: 46

PostPosted: Wed Jun 24, 2009 1:43 pm    Post subject: Reply with quote

It seems thath multipath was added to the latest genkernel 3.4.10.904...

But I have no news from developer since I wrote this patch....

I will try new genkernel when I have time...
Back to top
View user's profile Send private message
VinzC
Watchman
Watchman


Joined: 17 Apr 2004
Posts: 5098
Location: Dark side of the mood

PostPosted: Wed Jun 24, 2009 7:04 pm    Post subject: Reply with quote

dulrich wrote:
It seems thath multipath was added to the latest genkernel 3.4.10.904...

But I have no news from developer since I wrote this patch....

I will try new genkernel when I have time...


Newest genkernel doesn't work -- I've tried it. I've had to use your patch, slightly modified. Meanwhile there is also a problem with UDEV and scsi_id so that I've had to change the patch again... Hard but it works without the newst genkernel. I'll probably post the modifications I made soon.
_________________
Gentoo addict: tomorrow I quit, I promise!... Just one more emerge...
1739!
Back to top
View user's profile Send private message
dulrich
n00b
n00b


Joined: 23 Apr 2005
Posts: 46

PostPosted: Fri Jul 24, 2009 8:01 am    Post subject: Reply with quote

Newest multipath-tools are linked against new libs too. I think we need to do a multipath-tools staticly linked. It would be easier to maintain.
Back to top
View user's profile Send private message
VinzC
Watchman
Watchman


Joined: 17 Apr 2004
Posts: 5098
Location: Dark side of the mood

PostPosted: Fri Jul 24, 2009 9:34 am    Post subject: Reply with quote

I once automated the creation of an initrd by using ldd against each important file to know which dependencies to add. Maybe such a generic way can be used here?
_________________
Gentoo addict: tomorrow I quit, I promise!... Just one more emerge...
1739!
Back to top
View user's profile Send private message
dulrich
n00b
n00b


Joined: 23 Apr 2005
Posts: 46

PostPosted: Wed Sep 30, 2009 4:29 pm    Post subject: Reply with quote

I have proposed a new patch on Bugzilla for the "last" stable genkernel... I add support for new multipath (but there is a bug with kpartx) and I add support for execution of multipath at boot time in initramfs (which was not add to the last multipath).

I try now to test a xen kernel with multipath.
Back to top
View user's profile Send private message
VinzC
Watchman
Watchman


Joined: 17 Apr 2004
Posts: 5098
Location: Dark side of the mood

PostPosted: Wed Sep 30, 2009 6:03 pm    Post subject: Reply with quote

dulrich wrote:
I try now to test a xen kernel with multipath.

8) I am very interested! Please post whenever you have results.
_________________
Gentoo addict: tomorrow I quit, I promise!... Just one more emerge...
1739!
Back to top
View user's profile Send private message
dulrich
n00b
n00b


Joined: 23 Apr 2005
Posts: 46

PostPosted: Fri Oct 02, 2009 12:01 pm    Post subject: Reply with quote

So now I have a xen hypervisor on my gentoo. For that I use a 2.6.18 xen-sources. I compile a kernel with xen dom0 config (with multipath and qlogic support) and another with xen domU config. It's not possible to use last genkernel for it (some problems with vmlinuz instead of bzimage... etc).

I create an initramfs with dom0 modules/kernel with multipath support. My grub.conf :
Code:
title Gentoo Linux 2.6.18-r12 Xen domain 0
root (hd0,0)
kernel /boot/xen.gz
module /boot/kernel-2.6.18-xen-r12 root=/dev/ram0 init=/linuxrc ramdisk=8192 real_root=/dev/mapper/system3 udev domultipath
module /boot/initramfs-2.6.18-xen-r12


Now dom0 is on a SAN volume (boot on SAN)

I have some problem during boot up. The command /sbin/multipath does not detect correctly the path and I had to execute it by hand in shell rescue 4/5 times... and after this command I run /sbin/dmsetup ls --target multipath --exec "/sbin/kpartx -av" in order to create the correct mapping in /dev.

When the system is up it works like a charm. I have installed the domU1 on another volume on the SAN and mapped it in multipath.conf :
Code:
alpha ~ # multipath -ll
system (yy)
[size=20 GB][features=1 queue_if_no_path][hwhandler=0]
\_ round-robin 0 [prio=1][enabled]
 \_ 0:0:1:0 sda 8:0   [active][ready]
\_ round-robin 0 [prio=6][active]
 \_ 1:0:1:0 sdc 8:32  [active][ready]
sys1domU (xx)
[size=20 GB][features=1 queue_if_no_path][hwhandler=0]
\_ round-robin 0 [prio=1][enabled]
 \_ 0:0:1:1 sdb 8:16  [active][ready]
\_ round-robin 0 [prio=6][active]
 \_ 1:0:1:1 sdd 8:48  [active][ready]
alpha ~ # multipath -ll
system (yy)
[size=20 GB][features=1 queue_if_no_path][hwhandler=0]
\_ round-robin 0 [prio=1][enabled]
 \_ 0:0:1:0 sda 8:0   [active][ready]
\_ round-robin 0 [prio=6][active]
 \_ 1:0:1:0 sdc 8:32  [active][ready]
sys1domU (xx)
[size=20 GB][features=1 queue_if_no_path][hwhandler=0]
\_ round-robin 0 [prio=4][enabled]
 \_ 0:0:1:1 sdb 8:16  [active][ready]
\_ round-robin 0 [prio=3][enabled]
 \_ 1:0:1:1 sdd 8:48  [active][ready]
alpha ~ # multipath -ll
sdb: checker msg is "tur checker reports path is down"
sdd: checker msg is "tur checker reports path is down"
system (yy)
[size=20 GB][features=1 queue_if_no_path][hwhandler=0]
\_ round-robin 0 [prio=1][enabled]
 \_ 0:0:1:0 sda 8:0   [active][ready]
\_ round-robin 0 [prio=6][active]
 \_ 1:0:1:0 sdc 8:32  [active][ready]
sys1domU (xx)
[size=20 GB][features=1 queue_if_no_path][hwhandler=0]
\_ round-robin 0 [prio=0][active]
 \_ 0:0:1:1 sdb 8:16  [active][faulty]
\_ round-robin 0 [prio=0][enabled]
 \_ 1:0:1:1 sdd 8:48  [failed][faulty]
alpha ~ # multipath -ll
system (yy)
[size=20 GB][features=1 queue_if_no_path][hwhandler=0]
\_ round-robin 0 [prio=1][enabled]
 \_ 0:0:1:0 sda 8:0   [active][ready]
\_ round-robin 0 [prio=6][active]
 \_ 1:0:1:0 sdc 8:32  [active][ready]
sys1domU (xx)
[size=20 GB][features=1 queue_if_no_path][hwhandler=0]
\_ round-robin 0 [prio=6][active]
 \_ 0:0:1:1 sdb 8:16  [active][ready]
\_ round-robin 0 [prio=1][enabled]
 \_ 1:0:1:1 sdd 8:48  [active][ready]

I tried to change my prefered path some times and it works perfectly (with a small latency about 20s)... The domU don't see anything !


My domU1 config :
Code:
alpha ~ # cat /etc/xen/domU1
kernel = "/mnt/xen/kernels/kernel-2.6.18-xen-r12-domU"
memory = 8192
name   = "domU1"
extra  = "xencons=tty"
disk   = ['phy:/dev/mapper/sys1domU,sda,w']
root   = "/dev/sda3 ro"
vif    = [ 'mac=aa:00:00:00:00:01' ]
cpus = "0-7"
vcpus  = 8


Next step I want to see what LVM could be capable with 2 volumes in 2 differents SAN. In fact I have 2 paths on volumes on 2 different SAN on 2 distant sites. My SAN is a DS4000 series with only failover. Perharps I could do "raid1" LVM on 2 volumes (one on each SAN) so I could load balance the IO/s on the 2 SAN using 2 different controller... If one SAN goes down perharps my system will remain up.
Back to top
View user's profile Send private message
VinzC
Watchman
Watchman


Joined: 17 Apr 2004
Posts: 5098
Location: Dark side of the mood

PostPosted: Fri Oct 02, 2009 2:07 pm    Post subject: Reply with quote

I don't know if your issue and mine relate or not but currently I have had to unplug one of the fibre wire and leave only one fibre optics. The problem is that multipathd balances between channels, making both disk controllers in one bay switch for ever, which makes file reads/writes overly slow. Unplugging one fibre cable leaves only one path... which is stupid I know. But I haven't been able to solve that issue -- in fact I'd like to setup fail-over mode instead of an active-active configuration but I don't know how to do that.
_________________
Gentoo addict: tomorrow I quit, I promise!... Just one more emerge...
1739!
Back to top
View user's profile Send private message
dulrich
n00b
n00b


Joined: 23 Apr 2005
Posts: 46

PostPosted: Fri Oct 02, 2009 2:22 pm    Post subject: Reply with quote

VinzC wrote:
I don't know if your issue and mine relate or not but currently I have had to unplug one of the fibre wire and leave only one fibre optics. The problem is that multipathd balances between channels, making both disk controllers in one bay switch for ever, which makes file reads/writes overly slow. Unplugging one fibre cable leaves only one path... which is stupid I know. But I haven't been able to solve that issue -- in fact I'd like to setup fail-over mode instead of an active-active configuration but I don't know how to do that.


It depends what hardware you have. My DS4300 doesn't support active/active mode, only active/enabled. So you need to use the right script with multipathd. For IBM DS4000 it's mpath_prio_tpc (with multipath 0.4.7-r2) or mpath_prio_failover (with 0.4.8).
What multipath -ll gives you? And what /sbin/mpath_prio_tpc /dev/sda gives you?
Code:
defaults {
    udev_dir                /dev
    polling_interval        2
    getuid_callout          "/sbin/scsi_id -g -u -d /dev/%n"
    prio_callout            "/sbin/mpath_prio_tpc /dev/%n"
    user_friendly_names     yes
}

devices {
        device
        {
                vendor                  "IBM     "
                product                 "1722-600        "
                path_grouping_policy    group_by_serial
                path_checker            tur
                path_selector           "round-robin 0"
                prio_callout            "/sbin/mpath_prio_tpc /dev/%n"
                failback                immediate
                features                "1 queue_if_no_path"
                no_path_retry           300
        }
}
Back to top
View user's profile Send private message
VinzC
Watchman
Watchman


Joined: 17 Apr 2004
Posts: 5098
Location: Dark side of the mood

PostPosted: Fri Oct 02, 2009 2:28 pm    Post subject: Reply with quote

dulrich wrote:
What multipath -ll gives you? And what /sbin/mpath_prio_tpc /dev/sda gives you?

I'll have to wait until monday to check that. The disk bay is also IBM DS4000 series I'd say. I'll post here as soon as I get there.
_________________
Gentoo addict: tomorrow I quit, I promise!... Just one more emerge...
1739!
Back to top
View user's profile Send private message
VinzC
Watchman
Watchman


Joined: 17 Apr 2004
Posts: 5098
Location: Dark side of the mood

PostPosted: Fri Nov 27, 2009 3:39 pm    Post subject: Reply with quote

I've upgraded the server on which multipath is running. There's no mpath_prio_tpc anymore. I'm trying mpath_prio_rdac right now.
dulrich wrote:
What multipath -ll gives you? And what /sbin/mpath_prio_tpc /dev/sda gives you?

Code:
# /sbin/mpath_prio_rdac /dev/sde
3

multipath -ll:
fcs1p (3600a0b800013e6b2000003424781cfea) dm-4 IBM     ,1722-600     
[size=50G][features=0][hwhandler=0]
\_ round-robin 0 [prio=3][active]
 \_ 2:0:0:0 sdb 8:16  [active][ready]
fcd3p (3600a0b800021a3b0000001574a263ead) dm-7 IBM     ,1722-600     
[size=494G][features=0][hwhandler=0]
\_ round-robin 0 [prio=3][active]
 \_ 2:0:2:1 sdk 8:160 [active][ready]
fcd1p (3600a0b800013e6b2000003434781d00e) dm-5 IBM     ,1722-600     
[size=50G][features=0][hwhandler=0]
\_ round-robin 0 [prio=3][active]
 \_ 2:0:0:2 sdd 8:48  [active][ready]
fcd2p (3600a0b8000162ee9000002464a26370a) dm-6 IBM     ,1722-600     
[size=900G][features=0][hwhandler=0]
\_ round-robin 0 [prio=3][active]
 \_ 2:0:2:0 sdj 8:144 [active][ready]

This is before the upgrade. unfortunately even /etc/init.d/multipathd doesn't work completely as it doesn't create partitions anymore. The genkernel multipath image doesn't seem to work etiher...

For now I have disconnected one of the available paths. I'll update this post as soon as I have been able to get my partitions back...
_________________
Gentoo addict: tomorrow I quit, I promise!... Just one more emerge...
1739!
Back to top
View user's profile Send private message
dulrich
n00b
n00b


Joined: 23 Apr 2005
Posts: 46

PostPosted: Fri Nov 27, 2009 3:43 pm    Post subject: Reply with quote

Hello,

Try to emerge the unstable version of multipath 0.4.8... with ~amd64 keyword. It corrects a bug with multipath at boot time. You need a new initramfs too with the new lib of multipath.

You will probably need lvm2 (which replace device-mapper... with ~amd64 too)

My new config :
Code:

defaults {
    udev_dir                /dev
    polling_interval        2
    getuid_callout          "/sbin/scsi_id -g -u -d /dev/%n"
    prio_callout            "/sbin/mpath_prio_rdac /dev/%n"
    user_friendly_names     yes
}

devices {
        device
        {
                vendor                  "IBM     "
                product                 "1722-600        "
                path_grouping_policy    group_by_serial
                path_checker            rdac
                path_selector           "round-robin 0"
                prio_callout            "/sbin/mpath_prio_rdac /dev/%n"
                failback                immediate
      rr_weight      uniform
      hardware_handler    "1 rdac"
                features                "1 queue_if_no_path"
                no_path_retry           300
        }
}
multipaths {
        multipath {
            wwid        3600a0b80001f3e19000051af48ee0781
                alias       system
        }
        multipath {
            wwid        3600a0b80001f3e19000054bf4a125413
                alias       mysql
        }
}
devnode_blacklist {
       devnode "^(ram|raw|loop|fd|md|dm-|sr|scd|st)[0-9]*"
       devnode "^hd[a-z][[0-9]*]"
       devnode "^cciss!c[0-9]d[0-9]*[p[0-9]*]"
}
Back to top
View user's profile Send private message
VinzC
Watchman
Watchman


Joined: 17 Apr 2004
Posts: 5098
Location: Dark side of the mood

PostPosted: Fri Nov 27, 2009 4:28 pm    Post subject: Reply with quote

dulrich wrote:
Try to emerge the unstable version of multipath 0.4.8... with ~amd64 keyword. It corrects a bug with multipath at boot time. You need a new initramfs too with the new lib of multipath.

I have sys-fs/multipath-tools-0.4.8-r2. As for the initramfs, I used genkernel, which I already had to patch because it tried to copy /lib64/udev/scsi_id and I have a 32-bit x86 system... I'm using udev-146 as well. Genkernel is sys-kernel/genkernel-3.4.10.906.

dulrich wrote:
You will probably need lvm2 (which replace device-mapper... with ~amd64 too)

I've got sys-fs/lvm2-2.02.51-r1 and it already replaced dev-mapper.

Strangely enough, running dmsetup ls --target multipath --exec "/sbin/kpartx -a" after running command multipath does create all the required device nodes -- which confrms my multipath config file is working. Maybe I'll try a custom initramfs...
_________________
Gentoo addict: tomorrow I quit, I promise!... Just one more emerge...
1739!
Back to top
View user's profile Send private message
dulrich
n00b
n00b


Joined: 23 Apr 2005
Posts: 46

PostPosted: Fri Nov 27, 2009 4:55 pm    Post subject: Reply with quote

In my default/initrd.scripts I put :
Code:
 
                 good_msg "Scanning for multipath devices"
                 sleep 5
                /sbin/multipath -v 0
                 sleep 5
                #second time and sleeps to avoid some problems with old udev
                /sbin/multipath -v 0
                 good_msg "Activating multipath devices"
                /sbin/dmsetup ls --target multipath --exec "/sbin/kpartx -a -v"
                #for MULTIPATH_VOLUMES in /dev/mapper/*; do kpartx -a $MULTIPATH_VOLUMES; done


I change the order of execution between LVM, raid and multipath for this : 1. multipath 2. raid 3. LVM.
I use 2 SAN multipathed in raid 1 - so 2 volumes, one on each SAN wih 2 paths each.

The bug which was patched on multipath-0.4.8-r2 this month is for kpartx which didn't recognize the extended partitions (you must emerge --sync because Nov 5 05:15 multipath-tools-0.4.8-r2.ebuild).

I add a patch on multipath-tools too to avoid some problems when killing a path :
https://bugs.gentoo.org/show_bug.cgi?id=293615
Code:
--- multipath-tools/libcheckers/rdac.c.orig   2009-10-20 23:01:50.000000000 +0530
+++ multipath-tools/libcheckers/rdac.c   2009-10-20 23:49:31.000000000 +0530
@@ -91,7 +91,8 @@  do_inq(int sg_fd, unsigned int pg_op, vo
 
 struct volume_access_inq
 {
-   char dontcare0[8];
+   char PQ_PDT;
+   char dontcare0[7];
    char avtcvp;
    char dontcare1[39];
 };
@@ -105,6 +106,11 @@  libcheck_check (struct checker * c)
    if (0 != do_inq(c->fd, 0xC9, &inq, sizeof(struct volume_access_inq))) {
       MSG(c, MSG_RDAC_DOWN);
       return PATH_DOWN;
+   } else {
+      if ((inq.PQ_PDT & 0x20) || (inq.PQ_PDT & 0x7f)) {
+         /* LUN not connected*/
+         return PATH_DOWN;
+      }
    }
 
    if (inq.avtcvp & 0x1) {



I post here my last genkernel patch (on a brand new clean sys-kernel/genkernel-3.4.10.906) :
Code:
diff -ur genkernel.org/defaults/initrd.scripts genkernel/defaults/initrd.scripts
--- genkernel.org/defaults/initrd.scripts   2009-11-27 18:50:11.000000000 +0100
+++ genkernel/defaults/initrd.scripts   2009-11-20 16:37:36.000000000 +0100
@@ -567,6 +567,18 @@
       ln -sf /dev/device-mapper /dev/mapper/control
    fi
    
+       if [ "${USE_MULTIPATH_NORMAL}" = '1' ]
+       then
+                good_msg "Scanning for multipath devices"
+      sleep 5
+               /sbin/multipath -v 0
+             sleep 5
+      /sbin/multipath -v 0
+                good_msg "Activating multipath devices"
+             /sbin/dmsetup ls --target multipath --exec "/sbin/kpartx -a -v"
+       #for MULTIPATH_VOLUMES in /dev/mapper/*; do kpartx -a $MULTIPATH_VOLUMES; done
+       fi
+
    if [ "${USE_MDADM}" -eq '1' ]
    then
       if [ ! -e '/etc/mdadm.conf' ]
@@ -590,6 +602,18 @@
       fi
    fi
 
+#       if [ "${USE_MULTIPATH_NORMAL}" = '1' ]
+#       then
+#                good_msg "Scanning for multipath devices"
+#      sleep 5
+#               /sbin/multipath -v 0
+#             sleep 5
+#      /sbin/multipath -v 0
+#                good_msg "Activating multipath devices"
+#             /sbin/dmsetup ls --target multipath --exec "/sbin/kpartx -a -v"
+#       #for MULTIPATH_VOLUMES in /dev/mapper/*; do kpartx -a $MULTIPATH_VOLUMES; done
+#       fi
+
    if [ "${USE_LVM_NORMAL}" = '1' ]
    then
       if [ -e '/bin/vgscan' -a -e '/bin/vgchange' ]
diff -ur genkernel.org/defaults/linuxrc genkernel/defaults/linuxrc
--- genkernel.org/defaults/linuxrc   2009-11-27 18:50:11.000000000 +0100
+++ genkernel/defaults/linuxrc   2009-11-06 15:35:03.000000000 +0100
@@ -98,6 +98,10 @@
          DMRAID_OPTS=`parse_opt "${x}"`
          USE_DMRAID_NORMAL=1
       ;;
+            domultipath)
+               good_msg "Booting with multipath activated."
+               USE_MULTIPATH_NORMAL=1
+            ;;
       doevms)
          USE_EVMS_NORMAL=1
       ;;
diff -ur genkernel.org/gen_initramfs.sh genkernel/gen_initramfs.sh
--- genkernel.org/gen_initramfs.sh   2009-11-27 18:50:11.000000000 +0100
+++ genkernel/gen_initramfs.sh   2009-11-06 15:35:03.000000000 +0100
@@ -138,7 +138,7 @@
    mkdir -p "${TEMP}/initramfs-multipath-temp/lib/"
 
    # Copy files to /lib
-   for i in /lib/{ld-*,libc-*,libc.*,libdl-*,libdl.*,libsysfs*so*,libdevmapper*so*}
+   for i in /lib/{ld-*,libc-*,libc.*,libdl-*,libdl.*,libsysfs*so*,libdevmapper*so*,librt*so*,libpthread*so*,libreadline*so*,libncurses*so*}
    do
       cp -a "${i}" "${TEMP}/initramfs-multipath-temp/lib" \
          || gen_die "Could not copy file ${i} for MULTIPATH"
@@ -151,6 +151,13 @@
          || gen_die "Could not copy file ${i} for MULTIPATH"
    done
 
+        # Copy files to /usr/lib
+        for i in /usr/lib/libaio*so*
+        do
+                cp -a "${i}" "${TEMP}/initramfs-multipath-temp/lib" \
+                        || gen_die "Could not copy file ${i} for MULTIPATH"
+        done
+
    # Copy files to /bin
    for i in /bin/mountpoint
    do
@@ -162,11 +169,11 @@
    then
       cp /etc/multipath.conf "${TEMP}/initramfs-multipath-temp/etc/" || gen_die 'could not copy /etc/multipath.conf please check this'
    fi
-   if [ -x /sbin/scsi_id ]
+   if [ -x /lib64/udev/scsi_id ]
    then
       cp /etc/scsi_id.config "${TEMP}/initramfs-multipath-temp/etc/" || gen_die 'could not copy scsi_id.config'
    fi
-   cd "${TEMP/initramfs-multipath-temp/}"
+   cd "${TEMP}/initramfs-multipath-temp/"
    find . -print | cpio ${CPIO_ARGS} --append -F "${CPIO}"
    rm -r "${TEMP}/initramfs-multipath-temp/"
 }


Be sure to put the new variables in multipath.conf :
Code:
       
                path_checker            rdac
      hardware_handler    "1 rdac"
      rr_weight      uniform
                failback                immediate
                features                "1 queue_if_no_path"


with sys-fs/lvm2-2.02.51-r2
Back to top
View user's profile Send private message
VinzC
Watchman
Watchman


Joined: 17 Apr 2004
Posts: 5098
Location: Dark side of the mood

PostPosted: Fri Nov 27, 2009 8:54 pm    Post subject: Reply with quote

Thanks for the patch. I'll do some tests. If you don't mind just one suggestion though, I'd rather write this:
Code:
@@ -162,11 +169,11 @@
    then
       cp /etc/multipath.conf "${TEMP}/initramfs-multipath-temp/etc/" || gen_die 'could not copy /etc/multipath.conf please check this'
    fi
-   if [ -x /sbin/scsi_id ]
+   if [ -x /lib/udev/scsi_id ]
    then
       cp /etc/scsi_id.config "${TEMP}/initramfs-multipath-temp/etc/" || gen_die 'could not copy scsi_id.config'
    fi
-   cd "${TEMP/initramfs-multipath-temp/}"
+   cd "${TEMP}/initramfs-multipath-temp/"
    find . -print | cpio ${CPIO_ARGS} --append -F "${CPIO}"
    rm -r "${TEMP}/initramfs-multipath-temp/"
 }

I found using /lib on x86_64 is the same as /lib64 for the former is a symbolic link to the latter. That's what I had to fix to have genkernel not exit with an error.
_________________
Gentoo addict: tomorrow I quit, I promise!... Just one more emerge...
1739!
Back to top
View user's profile Send private message
VinzC
Watchman
Watchman


Joined: 17 Apr 2004
Posts: 5098
Location: Dark side of the mood

PostPosted: Sat Nov 28, 2009 3:33 pm    Post subject: Reply with quote

I'm currently doing some tests manually and I've noticed the following:
multipath -ll -v 2:
...
sdb: not found in pathvec
...
sdc: not found in pathvec
...
===== paths list =====
uuid hcil    dev dev_t pri dm_st  chk_st  vend/prod/rev
     #:#:#:# sdb 8:16  -1  [undef][undef] ,           
     #:#:#:# sdc 8:32  -1  [undef][undef] ,           
     #:#:#:# sdd 8:48  -1  [undef][undef] ,           
     #:#:#:# sde 8:64  -1  [undef][undef] ,           
     #:#:#:# sdf 8:80  -1  [undef][undef] ,           
     #:#:#:# sdg 8:96  -1  [undef][undef] ,           
...

multipath -ll:
fcs1p (3600a0b800013e6b2000003424781cfea) dm-4 ,
[size=50G][features=0][hwhandler=0]
\_ round-robin 0 [prio=3][active]
 \_ #:#:#:# sdb 8:16  [active][ready]
fcd3p (3600a0b800021a3b0000001574a263ead) dm-7 ,
[size=494G][features=0][hwhandler=0]
\_ round-robin 0 [prio=3][active]
 \_ #:#:#:# sdg 8:96  [active][ready]
fcd1p (3600a0b800013e6b2000003434781d00e) dm-5 ,
[size=50G][features=0][hwhandler=0]
\_ round-robin 0 [prio=3][active]
 \_ #:#:#:# sdd 8:48  [active][ready]
fcd2p (3600a0b8000162ee9000002464a26370a) dm-6 ,
[size=900G][features=0][hwhandler=0]
\_ round-robin 0 [prio=3][active]
 \_ #:#:#:# sdf 8:80  [active][ready]

What puzzles me is that I get that message "not found in pathvec" (don't even know what that means) and none of the SCSI disks bus ID seem to be recognized. However multipath works! I get my device nodes created but I would like to understand why.
_________________
Gentoo addict: tomorrow I quit, I promise!... Just one more emerge...
1739!
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum