[rear-devel] [rear/rear] 71ac3b: multipath: fix exclusion of still wanted devices

Renaud Métrich noreply at github.com
Mon Feb 14 13:28:07 CET 2022


  Branch: refs/heads/master
  Home:   https://github.com/rear/rear
  Commit: 71ac3b4a9041c198c841663d0b149e9d608c6a37
      https://github.com/rear/rear/commit/71ac3b4a9041c198c841663d0b149e9d608c6a37
  Author: Renaud Métrich <rmetrich at redhat.com>
  Date:   2022-02-14 (Mon, 14 Feb 2022)

  Changed paths:
    M usr/share/rear/layout/save/default/335_remove_excluded_multipath_vgs.sh

  Log Message:
  -----------
  multipath: fix exclusion of still wanted devices

The current code excluding multipath devices is broken when a device
being excluded matches other devices.
This leads to excluding wanted devices.
This happens when having custom alias for multipath devices *or* there
are more than 26 multipath devices and 'mpatha' is getting excluded,
which leads to excluding all 'mpathaX' devices are well.

See example below:
- have /boot on a dedicated multipath device 'mpathba'
- have / on a dedicated multipath device 'mpatha' and LVM vg 'rhel'
- have a dedicated multipath device 'mpathb' and LVM vg 'data'
- tell ReaR to only include 'rhel' VG (and not 'data' VG)
- tell ReaR to not auto-exclude multipath devices (otherwise everything
  gets commented out)

~~~
$ lsblk
NAME            MAJ:MIN RM  SIZE RO TYPE  MOUNTPOINT
sda               8:0    0    5G  0 disk
└─mpathba       253:1    0    5G  0 mpath
  └─mpathba1    253:2    0    1G  0 part  /boot
sdb               8:16   0    5G  0 disk
└─mpathba       253:1    0    5G  0 mpath
  └─mpathba1    253:2    0    1G  0 part  /boot
sdc               8:32   0   20G  0 disk
└─mpatha        253:0    0   20G  0 mpath
  ├─mpatha1     253:3    0    1G  0 part
  └─mpatha2     253:4    0   19G  0 part
    ├─rhel-root 253:5    0   10G  0 lvm   /
    └─rhel-swap 253:6    0    2G  0 lvm   [SWAP]
sdd               8:48   0   20G  0 disk
└─mpatha        253:0    0   20G  0 mpath
  ├─mpatha1     253:3    0    1G  0 part
  └─mpatha2     253:4    0   19G  0 part
    ├─rhel-root 253:5    0   10G  0 lvm   /
    └─rhel-swap 253:6    0    2G  0 lvm   [SWAP]
sde               8:64   0    2G  0 disk
└─mpathb        253:7    0    2G  0 mpath
sdf               8:80   0    2G  0 disk
└─mpathb        253:7    0    2G  0 mpath
sr0              11:0    1 1024M  0 rom

$ vgs
  VG   #PV #LV #SN Attr   VSize   VFree
  data   1   0   0 wz--n-  <2.00g <2.00g
  rhel   1   2   0 wz--n- <19.00g <7.00g

$ cat /etc/rear/local.conf
ONLY_INCLUDE_VG=("rhel")
AUTOEXCLUDE_MULTIPATH=n
~~~

With original code:
~~~
$ rear mkrescue
$ grep -v ^# /var/lib/rear/layout/disklayout.conf | grep "mpathba"
--> device excluded even though it hosts /boot
~~~

With the fix:
~~~
$ rear mkrescue
$ grep -v ^# /var/lib/rear/layout/disklayout.conf | grep "mpathba"
fs /dev/mapper/mpathba1 /boot xfs ...
multipath /dev/mapper/mpathba 5368709120 msdos /dev/sda,/dev/sdb
part /dev/mapper/mpathba 1073741824 1048576 primary none /dev/mapper/mpathba1
~~~

The root cause behind this is ReaR excludes 'mpathb' (hosting the 'data'
VG) through using a non-word matching *grep* command, which causes
'mpathba' (hosting /boot) to be excluded as well.

Signed-off-by: Renaud Métrich <rmetrich at redhat.com>


  Commit: c250be458efdf1145f48977dc4e3b06bdaab0415
      https://github.com/rear/rear/commit/c250be458efdf1145f48977dc4e3b06bdaab0415
  Author: Renaud Métrich <1163635+rmetrich at users.noreply.github.com>
  Date:   2022-02-14 (Mon, 14 Feb 2022)

  Changed paths:
    M usr/share/rear/layout/save/default/335_remove_excluded_multipath_vgs.sh

  Log Message:
  -----------
  Merge pull request #2750 from rmetrich/multipath_wrong_exclusion

multipath: fix exclusion of still wanted devices


Compare: https://github.com/rear/rear/compare/53757eab1447...c250be458efd


More information about the rear-devel mailing list