From d8d1e7213716835f263a4f20d9e6cf8719c210c0 Mon Sep 17 00:00:00 2001 From: Laszlo Ersek Date: Fri, 19 May 2023 17:55:07 +0200 Subject: [PATCH] inspector: test /dev/mapper/VG-LV translation in LUKS-on-LVM test In the LUKS-on-LVM virt-inspector test, run virt-inspector one more time, now with such "--key" options that exercise the recent "/dev/mapper/VG-LV" -> "/dev/VG/LV" translation (unescaping) from libguestfs-common. Verify that virt-inspector outputs the same XML as it did when we passed it the "/dev/VG/LV" format "--key" options. Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2168506 Signed-off-by: Laszlo Ersek Message-Id: <20230519155507.369494-4-lersek@redhat.com> Reviewed-by: Richard W.M. Jones (cherry picked from commit 569bd1dd29da7f3a7b3399ad85340f84d59b3a10) --- inspector/test-virt-inspector-luks-on-lvm.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/inspector/test-virt-inspector-luks-on-lvm.sh b/inspector/test-virt-inspector-luks-on-lvm.sh index 35454e630..13b25e338 100755 --- a/inspector/test-virt-inspector-luks-on-lvm.sh +++ b/inspector/test-virt-inspector-luks-on-lvm.sh @@ -41,6 +41,11 @@ keys=(--key /dev/Volume-Group/Root:key:FEDORA-Root --key /dev/Volume-Group/Logical-Volume-2:key:FEDORA-LV2 --key /dev/Volume-Group/Logical-Volume-3:key:FEDORA-LV3) +keys_mapper=(--key /dev/mapper/Volume--Group-Root:key:FEDORA-Root + --key /dev/mapper/Volume--Group-Logical--Volume--1:key:FEDORA-LV1 + --key /dev/mapper/Volume--Group-Logical--Volume--2:key:FEDORA-LV2 + --key /dev/mapper/Volume--Group-Logical--Volume--3:key:FEDORA-LV3) + # Ignore zero-sized file. if [ -s "$f" ]; then uuid_root=$(guestfish --ro -i -a "$f" "${keys[@]}" \ @@ -53,4 +58,10 @@ if [ -s "$f" ]; then # are any differences. sed -e "s/ROOTUUID/$uuid_root/" < "$srcdir/expected-$b.xml" \ | diff -u - "actual-$b.xml" + + # Re-run virt-inspector with keys using the /dev/mapper/VG-LV format; verify + # only that the XML output matches the output from the previous + # virt-inspector invocation (which used the /dev/VG/LV format). + $VG virt-inspector "${keys_mapper[@]}" --format=raw -a "$f" \ + | diff -u "actual-$b.xml" - fi