[Libguestfs] [v2v PATCH] convert_linux: remove LVM2 "devices file"

Laszlo Ersek
Fri, 05 Aug 2022 11:42:12 -0000

On 08/05/22 11:21, Richard W.M. Jones wrote:
> On Fri, Aug 05, 2022 at 10:44:26AM +0200, Laszlo Ersek wrote:
>> A recent feature of LVM2 is the "devices file"
>> <https://man7.org/linux/man-pages/man8/lvmdevices.8.html>. It
speeds up
>> LVM2 PV discovery on a normal system, but an old devices file in a
>> converted domain (with different hardware) can prevent the assembly of
>> volume groups.
>>
>> In particular, when converting a physical system to a guest with
virt-p2v,
>> the original system will have used "sys_wwid"-type
identifiers in the LVM2
>> devices file, and those are guaranteed not to match any virtio-blk
disks
>> in the output domain.
>>
>> We've seen a similar issue in the past under RHBZ#1164853, so just
extend
>> the same scrubbing with the new pathname.
>>
>> Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2112801
>> Signed-off-by: Laszlo Ersek <lersek at redhat.com>
>> ---
>>  convert/convert_linux.ml | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/convert/convert_linux.ml b/convert/convert_linux.ml
>> index a66ff1e45a57..2aaa438e42ac 100644
>> --- a/convert/convert_linux.ml
>> +++ b/convert/convert_linux.ml
>> @@ -1402,11 +1402,11 @@ let convert (g : G.guestfs) source inspect
keep_serial_console _ >>       * device names.  blkid will rebuild these
on demand.
>>       *
>>       * Delete the LVM cache since it will contain references to the
>> -     * old devices (RHBZ#1164853).
>> +     * old devices (RHBZ#1164853, RHBZ#2112801).
>>       *)
>>      List.iter g#rm_f [
>>        "/etc/blkid/blkid.tab"; "/etc/blkid.tab";
>> -      "/etc/lvm/cache/.cache"
>> +      "/etc/lvm/cache/.cache";
"/etc/lvm/devices/system.devices"
>>      ];
>
> I think this'll be fine so ACK.  In case you wanted to narrow the
> scope so the change is conditional on virt-p2v, you could check if
> source.s_hypervisor = Physical.

I think this is actually the right thing to do for when the source is
virtual as well. Currently we don't attempt to transfer hard disks'
wwids or serial numbers, even though that is theoretically possible. So
if the source hypervisor happens to configure such a wwn or serial
number, and that gets caught in the source guest's LVM devices file, it
will be absent on the destination similarly.

Thanks!
Laszlo