Comment 12 for bug 1838525

Revision history for this message
Rafael David Tinoco (rafaeldtinoco) wrote :

Reproducer:

#!/bin/bash

device_to_disk () {
    echo "$1" | \
        sed 's:\(/dev/[a-z]\+\).*:\1:'
}

device_to_disk /dev/mapper/vgubuntu-root

So device_to_disk() is doing what it is supposed to do and there was NO CHANGE to it (as it appears).

I guess using grub-install at /dev/vda was allowed before (instead of the LVM PV ?), so there wasn't a need to use /dev/mapper/vgubuntu-root as the argument for grub-installer.

It is either that OR the "/dev/mapper" section of this same script, related to:

case $prefix in
...
    /dev/mapper)
    disc_offered_devfs=...
...

couldn't deal with virtio disks on top of LVM (my next task here) as it should.

Simply using:

----

#!/bin/bash

device_to_disk () {
    echo "$1" | \
        sed 's:\(/dev/mapper/.*\+\|/dev/[a-z]\+\).*:\1:'
}

device_to_disk /dev/mapper/vgubuntu-root
device_to_disk /dev/something/else

$ ./temp.sh
/dev/mapper/vgubuntu-root
/dev/something
----

instead, keeps the same behavior for everything else AND fixes usage case where device is "/dev/mapper/XXXXX". This is ONE WAY of fixing this, BUT I guess the /dev/mapper section should also work for LVM w/ virtio disks, as stated in the script, so I'm investigating this.