[Libguestfs] [guestfs-tools PATCH 3/3] inspector: test /dev/mapper/VG-LV translation in LUKS-on-LVM test

Laszlo Ersek lersek at redhat.com
Fri May 19 15:55:07 UTC 2023


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 at redhat.com>
---

Notes:
    context:-U6

 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 35454e630d3d..13b25e338a87 100755
--- a/inspector/test-virt-inspector-luks-on-lvm.sh
+++ b/inspector/test-virt-inspector-luks-on-lvm.sh
@@ -38,19 +38,30 @@ fi
 f=../test-data/phony-guests/fedora-luks-on-lvm.img
 keys=(--key /dev/Volume-Group/Root:key:FEDORA-Root
       --key /dev/Volume-Group/Logical-Volume-1:key:FEDORA-LV1
       --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[@]}" \
                     luks-uuid /dev/Volume-Group/Root)
     b=$(basename "$f")
     $VG virt-inspector "${keys[@]}" --format=raw -a "$f" > "actual-$b.xml"
     # Check the generated output validate the schema.
     $XMLLINT --noout --relaxng "$srcdir/virt-inspector.rng" "actual-$b.xml"
     # This 'diff' command will fail (because of -e option) if there
     # 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


More information about the Libguestfs mailing list