Laszlo Ersek
2023-May-19 14:08 UTC
[Libguestfs] [libguestfs PATCH 0/3] test "/dev/mapper/VG-LV" with "--key"
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2168506 This small set covers the new /dev/mapper/VG-LV "--key" ID format in the libguestfs LUKS-on-LVM inspection test. Thanks, Laszlo Laszlo Ersek (3): update common submodule LUKS-on-LVM inspection test: rename VGs and LVs LUKS-on-LVM inspection test: test /dev/mapper/VG-LV translation common | 2 +- test-data/phony-guests/make-fedora-img.pl | 30 +++++++++-------- tests/luks/test-key-option-inspect-luks-on-lvm.sh | 34 +++++++++++++++----- 3 files changed, 44 insertions(+), 22 deletions(-) base-commit: 692802bf96e0c76363d26d78a105fb79ada736de
Laszlo Ersek
2023-May-19 14:08 UTC
[Libguestfs] [libguestfs PATCH 1/3] update common submodule
Laszlo Ersek (2): options/keys: key_store_import_key(): un-constify "key" parameter options/keys: introduce unescape_device_mapper_lvm() Richard W.M. Jones (1): mlcustomize/SELinux_relabel.ml: Use Array.mem Roman Kagan (1): mlcustomize: skip SELinux relabeling if it's disabled Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2168506 Signed-off-by: Laszlo Ersek <lersek at redhat.com> --- common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common b/common index 70c10a079a30..b636c3f20a1b 160000 --- a/common +++ b/common @@ -1 +1 @@ -Subproject commit 70c10a079a30ff3a84f38596d725a6c5d46e2470 +Subproject commit b636c3f20a1b8d1a6a75f33dcb1fd931c95c5e00
Laszlo Ersek
2023-May-19 14:08 UTC
[Libguestfs] [libguestfs PATCH 2/3] LUKS-on-LVM inspection test: rename VGs and LVs
In preparation for a subsequent patch, rename "VG" to "Volume-Group", and "LV<n>" to "Logical-Volume-<n>", in the LUKS-on-LVM inspection test. Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2168506 Signed-off-by: Laszlo Ersek <lersek at redhat.com> --- test-data/phony-guests/make-fedora-img.pl | 30 +++++++++++--------- tests/luks/test-key-option-inspect-luks-on-lvm.sh | 16 +++++------ 2 files changed, 25 insertions(+), 21 deletions(-) diff --git a/test-data/phony-guests/make-fedora-img.pl b/test-data/phony-guests/make-fedora-img.pl index c0cb5d0b5a3a..6362e225b3b7 100755 --- a/test-data/phony-guests/make-fedora-img.pl +++ b/test-data/phony-guests/make-fedora-img.pl @@ -224,23 +224,27 @@ EOF # Create the Volume Group on /dev/sda2. $g->pvcreate ('/dev/sda2'); - $g->vgcreate ('VG', ['/dev/sda2']); - $g->lvcreate ('Root', 'VG', 32); - $g->lvcreate ('LV1', 'VG', 32); - $g->lvcreate ('LV2', 'VG', 32); - $g->lvcreate ('LV3', 'VG', 64); + $g->vgcreate ('Volume-Group', ['/dev/sda2']); + $g->lvcreate ('Root', 'Volume-Group', 32); + $g->lvcreate ('Logical-Volume-1', 'Volume-Group', 32); + $g->lvcreate ('Logical-Volume-2', 'Volume-Group', 32); + $g->lvcreate ('Logical-Volume-3', 'Volume-Group', 64); # Format each Logical Group as a LUKS device, with a different password. - $g->luks_format ('/dev/VG/Root', 'FEDORA-Root', 0); - $g->luks_format ('/dev/VG/LV1', 'FEDORA-LV1', 0); - $g->luks_format ('/dev/VG/LV2', 'FEDORA-LV2', 0); - $g->luks_format ('/dev/VG/LV3', 'FEDORA-LV3', 0); + $g->luks_format ('/dev/Volume-Group/Root', 'FEDORA-Root', 0); + $g->luks_format ('/dev/Volume-Group/Logical-Volume-1', 'FEDORA-LV1', 0); + $g->luks_format ('/dev/Volume-Group/Logical-Volume-2', 'FEDORA-LV2', 0); + $g->luks_format ('/dev/Volume-Group/Logical-Volume-3', 'FEDORA-LV3', 0); # Open the LUKS devices. This creates nodes like /dev/mapper/*-luks. - $g->cryptsetup_open ('/dev/VG/Root', 'FEDORA-Root', 'Root-luks'); - $g->cryptsetup_open ('/dev/VG/LV1', 'FEDORA-LV1', 'LV1-luks'); - $g->cryptsetup_open ('/dev/VG/LV2', 'FEDORA-LV2', 'LV2-luks'); - $g->cryptsetup_open ('/dev/VG/LV3', 'FEDORA-LV3', 'LV3-luks'); + $g->cryptsetup_open ('/dev/Volume-Group/Root', + 'FEDORA-Root', 'Root-luks'); + $g->cryptsetup_open ('/dev/Volume-Group/Logical-Volume-1', + 'FEDORA-LV1', 'LV1-luks'); + $g->cryptsetup_open ('/dev/Volume-Group/Logical-Volume-2', + 'FEDORA-LV2', 'LV2-luks'); + $g->cryptsetup_open ('/dev/Volume-Group/Logical-Volume-3', + 'FEDORA-LV3', 'LV3-luks'); # Phony root filesystem. $g->mkfs ('ext2', '/dev/mapper/Root-luks', blocksize => 4096, label => 'ROOT'); diff --git a/tests/luks/test-key-option-inspect-luks-on-lvm.sh b/tests/luks/test-key-option-inspect-luks-on-lvm.sh index 52cd7e984304..a8d72b9f9463 100755 --- a/tests/luks/test-key-option-inspect-luks-on-lvm.sh +++ b/tests/luks/test-key-option-inspect-luks-on-lvm.sh @@ -30,10 +30,10 @@ skip_unless_phony_guest fedora-luks-on-lvm.img # Volume names. guestfish=(guestfish --listen --ro --inspector --add ../test-data/phony-guests/fedora-luks-on-lvm.img) -keys_by_lvname=(--key /dev/VG/Root:key:FEDORA-Root - --key /dev/VG/LV1:key:FEDORA-LV1 - --key /dev/VG/LV2:key:FEDORA-LV2 - --key /dev/VG/LV3:key:FEDORA-LV3) +keys_by_lvname=(--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) # The variable assignment below will fail, and abort the script, if guestfish # refuses to start up. @@ -56,10 +56,10 @@ function cleanup_guestfish trap cleanup_guestfish EXIT # Get the UUIDs of the LUKS devices. -uuid_root=$(guestfish --remote -- luks-uuid /dev/VG/Root) -uuid_lv1=$( guestfish --remote -- luks-uuid /dev/VG/LV1) -uuid_lv2=$( guestfish --remote -- luks-uuid /dev/VG/LV2) -uuid_lv3=$( guestfish --remote -- luks-uuid /dev/VG/LV3) +uuid_root=$(guestfish --remote -- luks-uuid /dev/Volume-Group/Root) +uuid_lv1=$( guestfish --remote -- luks-uuid /dev/Volume-Group/Logical-Volume-1) +uuid_lv2=$( guestfish --remote -- luks-uuid /dev/Volume-Group/Logical-Volume-2) +uuid_lv3=$( guestfish --remote -- luks-uuid /dev/Volume-Group/Logical-Volume-3) # The actual test. function check_filesystems
Laszlo Ersek
2023-May-19 14:08 UTC
[Libguestfs] [libguestfs PATCH 3/3] LUKS-on-LVM inspection test: test /dev/mapper/VG-LV translation
In the LUKS-on-LVM inspection test, call the "check_filesystems" function yet another time, now with such "--key" options that exercise the recent "/dev/mapper/VG-LV" -> "/dev/VG/LV" translation (unescaping) from libguestfs-common. Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2168506 Signed-off-by: Laszlo Ersek <lersek at redhat.com> --- tests/luks/test-key-option-inspect-luks-on-lvm.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/luks/test-key-option-inspect-luks-on-lvm.sh b/tests/luks/test-key-option-inspect-luks-on-lvm.sh index a8d72b9f9463..932862b17d4a 100755 --- a/tests/luks/test-key-option-inspect-luks-on-lvm.sh +++ b/tests/luks/test-key-option-inspect-luks-on-lvm.sh @@ -101,3 +101,21 @@ eval "$fish_ref" # Repeat the test. check_filesystems + +# Exit the current guestfish background process. +guestfish --remote -- exit +GUESTFISH_PID+ +# Start up another guestfish background process, and specify the keys in +# /dev/mapper/VG-LV format this time. +keys_by_mapper_lvname=( + --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 +) +fish_ref=$("${guestfish[@]}" "${keys_by_mapper_lvname[@]}") +eval "$fish_ref" + +# Repeat the test. +check_filesystems