Laszlo Ersek
2023-May-19 15:55 UTC
[Libguestfs] [guestfs-tools PATCH 3/3] 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 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
Richard W.M. Jones
2023-May-19 16:31 UTC
[Libguestfs] [guestfs-tools PATCH 3/3] inspector: test /dev/mapper/VG-LV translation in LUKS-on-LVM test
For the series: Reviewed-by: Richard W.M. Jones <rjones at redhat.com> BTW it's usually possible to cherry pick across git repos, eg: $ git fetch ../libguestfs $ git cherry-pick -x <hash> Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-p2v converts physical machines to virtual machines. Boot with a live CD or over the network (PXE) and turn machines into KVM guests. http://libguestfs.org/virt-v2v
Reasonably Related Threads
- [guestfs-tools PATCH 3/3] inspector: test /dev/mapper/VG-LV translation in LUKS-on-LVM test
- [libguestfs PATCH 3/3] LUKS-on-LVM inspection test: test /dev/mapper/VG-LV translation
- [guestfs-tools PATCH 0/3] test "/dev/mapper/VG-LV" with "--key"
- [libguestfs PATCH 0/3] test "/dev/mapper/VG-LV" with "--key"
- Re: luks ecrypted storage poll - lvm - possible?