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

Laszlo Ersek
Fri, 05 Aug 2022 08:44:26 -0000

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"
     ];
   in

--
2.19.1.3.g30247aa5d201