Changeset 2072 in MondoRescue


Ignore:
Timestamp:
Dec 5, 2008, 3:32:59 PM (12 years ago)
Author:
Bruno Cornec
Message:
  • Adds multipath support (as exists on RHEL 5.2)
    • analyze-my-lvm/mindi uses the /dev/mapper/mpath... entry and not /dev/dm-... entry which is not automatically created at restore time
    • Lots of mapth dmsetup commands added to deplist
    • Adds required modules to mindi
    • Fix a bug for this in mindi around real devices with /dev/mapper/mpath... names
    • init has a new StartMpath? function to start multipath correctly hopefully
    • mondorestore has a new clean_multiconf function which removes /var/lib/multipath/bindings and edits /etc/multipath.conf if needed
Location:
branches/2.2.8
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2.8/mindi/analyze-my-lvm

    r2044 r2072  
    117117        done
    118118    fi
     119    l=""
     120    if [ -f /etc/multipath.conf ]; then
     121        # If multipath check which type of devidec are given, mpath prefered
     122        for d in $list_of_devices; do
     123            l="$l `GiveMapperOfdm $d`"
     124        done
     125        list_of_devices=$l
     126    fi
     127
    119128    echo "# $LVMCMD vgcreate $current_VG$VG_params $list_of_devices"
    120129    echo "# $LVMCMD vgchange -a y $current_VG"
     
    125134ListAllPhysicalVolumes() {
    126135    if [ $lvmversion = 2 ]; then
    127         $LVMCMD pvscan 2> /dev/null | grep 'PV' | awk '{print $2}'
    128     else
    129         pvscan 2> /dev/null | grep '"' | cut -d'"' -f2
    130     fi
     136        $LVMCMD pvscan 2> /dev/null | grep 'PV' | awk '{print $2}' >  $MINDI_TMP/pv.tmp
     137    else
     138        pvscan 2> /dev/null | grep '"' | cut -d'"' -f2  >  $MINDI_TMP/pv.tmp
     139    fi
     140    if [ -f /etc/multipath.conf ]; then
     141        # If multipath check which type of devidec are given, mpath prefered
     142        for d in `cat  $MINDI_TMP/pv.tmp`; do
     143            GiveMapperOfdm $d
     144        done
     145    else
     146        cat $MINDI_TMP/pv.tmp
     147    fi
     148    rm -f $MINDI_TMP/pv.tmp
    131149}
    132150
     
    136154}
    137155
     156GiveMapperOfdm () {
     157
     158major=`stat -c "%t" $1`
     159minor=`stat -c "%T" $1`
     160
     161for i in `ls /dev/mapper/*`; do
     162    mj=`stat -c "%t" $i`
     163    mn=`stat -c "%T" $i`
     164    if [ "$mj" = "$major" ] && [ "$mn" = "$minor" ]; then
     165        echo "$i"
     166        return
     167    fi
     168done
     169echo $1
     170}
     171
    138172
    139173ListLvmDrivesAndPartitions() {
    140     $LVMCMD vgdisplay -v 2> /dev/null | grep "PV Name" | sed 's/(#)//' | awk '{print $3}'
     174    $LVMCMD vgdisplay -v 2> /dev/null | grep "PV Name" | sed 's/(#)//' | awk '{print $3}' > $MINDI_TMP/vg.tmp
     175    if [ -f /etc/multipath.conf ]; then
     176        # If multipath check which type of devidec are given, mpath prefered
     177        for d in `cat  $MINDI_TMP/vg.tmp`; do
     178            GiveMapperOfdm $d
     179        done
     180    else
     181        cat $MINDI_TMP/vg.tmp
     182    fi
     183    rm -f $MINDI_TMP/vg.tmp
    141184}
    142185
  • branches/2.2.8/mindi/deplist.txt

    r2031 r2072  
    2828/usr/sbin/mondorestore
    2929/etc/mdadm/mdadm.conf /etc/mdadm.conf
     30/sbin/multipath /sbin/dmsetup /sbin/kpartx /sbin/dmraid /sbin/scsi_id /sbin/mpath_prio_alua /sbin/mpath_wait /sbin/mpath_ctl /sbin/mpath_prio_emc /sbin/mpath_prio_hds_modular /sbin/mpath_prio_netapp /sbin/mpath_prio_ontap /sbin/mpath_prio_rdac /sbin/mpath_prio_tpc
    3031/sbin/ldconfig
    3132afio star ntfsclone parted partprobe ms-sys file getfattr setfattr getfacl setfacl
  • branches/2.2.8/mindi/mindi

    r2070 r2072  
    5757CDROM_MODS="$TAPE_MODS $IDE_MODS $USB_MODS $PCMCIA_MODS $SCSI_MODS $NET_MODS af_packet cdrom isocd isofs inflate_fs nls_iso8859-1 nls_base nls_cp437 nls_utf8 sg sr_mod zlib_inflate iso9660"
    5858# Those modules will only go on the backup media, not the boot media.
    59 EXTRA_MODS="$CDROM_MODS vfat fat loop md-mod linear raid0 raid1 xor raid5 raid456 lvm-mod dm-mod dm_mod dm-snapshot dm_snapshot dm-zero dm_zero dm-mirror dm_mirror dm-multipath dm_multipath dm-round-robin dm_round_robin jfs xfs xfs_support pagebuf reiserfs ext2 ext3 minix nfs nfs_acl nfsd lockd sunrpc jbd mbcache"
     59EXTRA_MODS="$CDROM_MODS vfat fat loop md-mod linear raid0 raid1 xor raid5 raid456 lvm-mod dm-mod dm_mod dm-snapshot dm_snapshot dm-zero dm_zero dm-mirror dm_mirror dm-multipath dm-round-robin jfs xfs xfs_support pagebuf reiserfs ext2 ext3 minix nfs nfs_acl nfsd lockd sunrpc jbd mbcache"
    6060# Replace with that line for HP OCMP e.g.
    6161#DENY_MODS="MPS_Driver_Mapper mps octtldrv tscttl streams kqemu"
     
    11541154                echo "WARNING: Multiple Logical Volumes found. Report to dev team" >> $LOGFILE 
    11551155            fi
     1156            # if it's not found, it may well be a real device such as a multipath one
     1157            # /dev/mapper/mpath... Thus we revert the situation so that next test succeed
     1158            if [ _"$current_lvolume" = _"" ]; then
     1159                current_lvolume="$current_partition"
     1160            fi
    11561161        fi
    11571162        #
     
    21962201        tar cf - /etc/udev 2> /dev/null | tar xf -
    21972202        # This avoids NIC remapping if on another machine at restore time on Debian at least
    2198         rm -f ./etc/udev/rules.d/z25_persistent-net.rules
     2203        rm -f ./etc/udev/rules.d/z??_persistent-net.rules
    21992204        tar cf - /lib*/udev 2> /dev/null | tar xf -
    22002205        if [ -x /sbin/udevd ]; then
  • branches/2.2.8/mindi/rootfs/sbin/init

    r2015 r2072  
    406406}
    407407
     408
     409StartMpath() {
     410    if [ "`grep -i nompath /proc/cmdline`" ]; then
     411        return;
     412    fi
     413    echo "Starting Mpath..."
     414    if [ -x /sbin/multipath ]; then
     415        mkdir -p /var/lib/multipath
     416        cat > /etc/multipath.conf << EOF
     417defaults {
     418        user_friendly_names yes
     419}
     420EOF
     421        /sbin/multipath -v 0
     422        if [ -x /sbin/kpartx ]; then
     423            /sbin/dmsetup ls --target multipath --exec "/sbin/kpartx -a -p p"
     424        fi
     425    fi
     426}
    408427
    409428StartRaids() {
     
    440459                fi
    441460            fi
     461        done
     462    elif
     463        if [ "`grep -i nodmraid /proc/cmdline`" ]; then
     464            return;
     465        fi
     466        for x in $(/sbin/dmraid -ay -i -p -t 2>/dev/null | grep -E  -iv "^no " |awk -F ':' '{ print $1 }') ; do
     467            echo "Please send the result of /sbin/dmraid -ay -i -p -t to the devteam !!!"
     468            return
     469            #dmname=$(resolve_dm_name $x)
     470            #[ -z "$dmname" ] && continue
     471            #/sbin/dmraid  -ay -i -p "$dmname" >/dev/null 2>&1
     472            #/sbin/kpartx -a -p p "/dev/mapper/$dmname"
    442473        done
    443474    else
     
    672703PauseForRaids
    673704StartRaids
     705StartMpath
    674706StartLvms
    675707CopyBootDevEntry
  • branches/2.2.8/mondo/src/mondorestore/mondorestore.c

    r2061 r2072  
    366366    asprintf(&tmp1,"%s/etc/blkid.tab.old",bkpinfo->restore_path);
    367367    (void)unlink(tmp1);
     368    paranoid_free(tmp1);
     369}
     370
     371
     372static void clean_multiconf() {
     373
     374    char *tmp1 = NULL;
     375
     376    /* Clean up multiconf cache file if they exist */
     377    asprintf(&tmp1,"%s/var/lib/multipath/bindings",bkpinfo->restore_path);
     378    (void)unlink(tmp1);
     379    paranoid_free(tmp1);
     380
     381    /* Edit multipath.conf if needed to adapt wwid */
     382    asprintf(&tmp1,"%s/etc/multipath.conf", MNT_RESTORING);
     383    if (does_file_exist(tmp1)) {
     384        log_msg(2, "We may need to clean /etc/multipath.conf");
     385    } else {
     386        paranoid_free(tmp1);
     387        return();
     388    }
     389    paranoid_free(tmp1);
     390    asprintf(&tmp1,"chroot %s %s /etc/multipath.conf", MNT_RESTORING, editor);
     391    paranoid_system(tmp1);
    368392    paranoid_free(tmp1);
    369393}
     
    612636
    613637    clean_blkid();
     638    clean_multiconf();
    614639    protect_against_braindead_sysadmins();
    615640    retval += unmount_all_devices(mountlist);
     
    845870    }
    846871    clean_blkid();
     872    clean_multiconf();
    847873    protect_against_braindead_sysadmins();
    848874    retval += unmount_all_devices(mountlist);
Note: See TracChangeset for help on using the changeset viewer.