guestfs-tools/0007-inspector-test-dev-mapper-VG-LV-translation-in-LUKS-.patch
Laszlo Ersek 457bbcca1e let virt-inspector recognize "--key /dev/mapper/VG-LV🔑password"
resolves: rhbz#2209280
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
2023-06-08 15:52:37 +02:00

49 lines
2.3 KiB
Diff

From d8d1e7213716835f263a4f20d9e6cf8719c210c0 Mon Sep 17 00:00:00 2001
From: Laszlo Ersek <lersek@redhat.com>
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 <lersek@redhat.com>
Message-Id: <20230519155507.369494-4-lersek@redhat.com>
Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
(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