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

Richard W.M. Jones
Fri, 05 Aug 2022 09:21:02 -0000

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.

Rich.

--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
Fedora Windows cross-compiler. Compile Windows programs, test, and
build Windows installers. Over 100 libraries supported.