#1801 PR merged: exclude multipath device that does not have mounted fs

Labels: bug, fixed / solved / done

schabrolles opened issue at 2018-05-08 12:30:

Relax-and-Recover (ReaR) Pull Request Template

Please fill in the following items before submitting a new pull request:

Pull Request Details:
  • Type: Bug Fix

  • Impact: Normal

  • Reference to related issue (URL):
    https://github.com/rear/rear/issues/1767

  • How was this pull request tested?
    SLES12SP2 on POWER with multipath devices

  • Brief description of the changes in this pull request:
    The actual code without this patch just exclude "real disk" which doesn't have fs mounted, not mutlipath devices.
    This path check if fs has parent device in disk AND multipath, then exclude disk and multipath with no fs mounted.

jsmeix commented at 2018-05-09 09:11:

@schabrolles
please add explanatory comments why "multipath" is also there
so that others at any later time (who may konw nothing about "multipath")
immediately understand how "multipath" also belongs there.

Only optionally:
Could you perhaps "by the way" also clean up code like

if [[ "$AUTOEXCLUDE_..." =~ ^[yY1] ]] ; then

to the current way like

if is_true "$AUTOEXCLUDE_..." ; then

jsmeix commented at 2018-05-09 09:52:

Meanwhile I may no longer understand how that autoexlude code is meant in general,
see https://github.com/rear/rear/issues/1767#issuecomment-387685874

jsmeix commented at 2018-05-09 12:28:

After looking a bit closer I think meanwhile I do again understand it
and this is what I currently think how that autoexlude code is meant:

When AUTOEXCLUDE_DISKS is true
it collects in the used_disks array
all disks that are somehow used
for swap and/or by a mounted filesystem
and then it automatically excludes only those disks
that are not in the used_disks array.

This means a disk that has partitions
for supported and mounted filesystems
plus partitions for unsupported filesystems
will not be automatically excluded
when at least one of its partitions is used
(as swap or by a mounted filesystem).

Your change enhances that by also
automatically excluding multipath devices
when none of its partitions is used
(as swap or by a mounted filesystem).

If my current understanding is actually right,
your changes look perfectly right to me.

schabrolles commented at 2018-05-09 14:15:

Last changes ... Add comments and also replace find_disk by find_disk_and_multiapth function during swap parent device detection.


[Export of Github issue for rear/rear.]