#3334 PR merged: Fix get_disklabel_type() not returning anything for multipath devices

Labels: enhancement, fixed / solved / done

rmetrich opened issue at 2024-10-22 08:36:

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

  • How was this pull request tested?

Tested on RHEL9 with a QEMU/KVM system having the disks in multipath:

$ virsh dumpxml multipath9
[...]
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw' cache='none' discard='unmap'/>
      <source file='/var/lib/libvirt/images/multipath9.img' index='2'/>
      <backingStore/>
      <target dev='sdb' bus='scsi'/>
      <shareable/>
      <serial>OSDISK</serial>
      <alias name='scsi0-0-0-1'/>
      <address type='drive' controller='0' bus='0' target='0' unit='1'/>
    </disk>
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw' cache='none' discard='unmap'/>
      <source file='/var/lib/libvirt/images/multipath9.img' index='1'/>
      <backingStore/>
      <target dev='sdc' bus='scsi'/>
      <shareable/>
      <serial>OSDISK</serial>
      <alias name='scsi0-0-0-2'/>
      <address type='drive' controller='0' bus='0' target='0' unit='2'/>
    </disk>
[...]

# cat /etc/rear/local.conf
[...]
ONLY_INCLUDE_VG=( "rhel" )
AUTOEXCLUDE_MULTIPATH=n
FIRMWARE_FILES=( 'no' )
[...]
  • Description of the changes in this pull request:

Without this fix, get_disklabel_type() used to find the Grub device to install Grub on was returning nothing when the disk was a multipath device, leading to the error below:

2024-10-22 10:10:05.114081935 Determining where to install GRUB2 (no GRUB2_INSTALL_DEVICES specified)
 :
+++ get_disklabel_type /dev/mapper/0QEMU_QEMU_HARDDISK_OSDISK +++ local component disk size label junk
+++ disk=
+++ read component disk size label junk
++++ grep '^disk /dev/mapper/0QEMU_QEMU_HARDDISK_OSDISK ' /var/lib/rear/layout/disklayout.conf
+++ test
+++ return 1
++ label=
++ return 1
 :
2024-10-22 10:10:05.148970198 Failed to install GRUB2 - you may have to manually install it

The reason for this is the disklayout contains a line starting with multipath but ReaR code searches for disk only.

jsmeix commented at 2024-10-22 10:27:

@rear/contributors
provided there are no objections
I would like to merge it on Thursday afternoon

jsmeix commented at 2024-10-22 10:34:

@rmetrich
thank you for your various contributions
that improve multipath related behaviour of ReaR!

Out of curiosity:
I assume with properly specified GRUB2_INSTALL_DEVICES
it works that GRUB gets installed as bootloader
when the system disk is a multipath device.
In this case I would consider a missing automatism
not an actual "bug" but a missing "enhancement".


[Export of Github issue for rear/rear.]