From 866a8efa7256de481c03fc172073cd3287522855 Mon Sep 17 00:00:00 2001 From: Lukáš Růžička Date: Feb 19 2021 21:42:20 +0000 Subject: Add a new testcase to test creation of LVM with ext4 using Blivet. This PR adds a test that uses the Blivet interface to create an LVM layout with ext4 filesystem as well as a postinstall test that checks that the LVM layout has been created correctly. --- diff --git a/needles/anaconda/partitioning/blivet/anaconda_blivet_part_devicetype_lvm-20210208.json b/needles/anaconda/partitioning/blivet/anaconda_blivet_part_devicetype_lvm-20210208.json new file mode 100644 index 0000000..1b2c79a --- /dev/null +++ b/needles/anaconda/partitioning/blivet/anaconda_blivet_part_devicetype_lvm-20210208.json @@ -0,0 +1,15 @@ +{ + "area": [ + { + "height": 26, + "ypos": 145, + "xpos": 397, + "width": 64, + "type": "match" + } + ], + "properties": [], + "tags": [ + "anaconda_blivet_part_devicetype_lvm" + ] +} \ No newline at end of file diff --git a/needles/anaconda/partitioning/blivet/anaconda_blivet_part_devicetype_lvm-20210208.png b/needles/anaconda/partitioning/blivet/anaconda_blivet_part_devicetype_lvm-20210208.png new file mode 100644 index 0000000..ded5435 Binary files /dev/null and b/needles/anaconda/partitioning/blivet/anaconda_blivet_part_devicetype_lvm-20210208.png differ diff --git a/needles/anaconda/partitioning/blivet/anaconda_blivet_part_devicetype_lvm.json b/needles/anaconda/partitioning/blivet/anaconda_blivet_part_devicetype_lvm.json new file mode 100644 index 0000000..fc4e49a --- /dev/null +++ b/needles/anaconda/partitioning/blivet/anaconda_blivet_part_devicetype_lvm.json @@ -0,0 +1,15 @@ +{ + "properties": [], + "tags": [ + "anaconda_blivet_part_devicetype_lvm" + ], + "area": [ + { + "xpos": 415, + "ypos": 149, + "width": 84, + "height": 18, + "type": "match" + } + ] +} \ No newline at end of file diff --git a/needles/anaconda/partitioning/blivet/anaconda_blivet_part_devicetype_lvm.png b/needles/anaconda/partitioning/blivet/anaconda_blivet_part_devicetype_lvm.png new file mode 100644 index 0000000..0734d32 Binary files /dev/null and b/needles/anaconda/partitioning/blivet/anaconda_blivet_part_devicetype_lvm.png differ diff --git a/templates.fif.json b/templates.fif.json index 02762ae..8df415c 100644 --- a/templates.fif.json +++ b/templates.fif.json @@ -956,6 +956,19 @@ "ROOT_PASSWORD": "weakpassword" } }, + "install_blivet_lvm_ext4": { + "profiles": { + "fedora-Server-dvd-iso-aarch64-*-aarch64": 40, + "fedora-Server-dvd-iso-ppc64le-*-ppc64le": 40, + "fedora-Server-dvd-iso-x86_64-*-64bit": 40, + "fedora-Server-dvd-iso-x86_64-*-uefi": 41 + }, + "settings": { + "PARTITIONING": "custom_blivet_lvm_ext4", + "POSTINSTALL": "disk_custom_lvm_ext4_postinstall", + "ROOT_PASSWORD": "weakpassword" + } + }, "install_blivet_standard_partition_ext4": { "profiles": { "fedora-Server-dvd-iso-aarch64-*-aarch64": 40, @@ -1249,7 +1262,7 @@ "fedora-Server-dvd-iso-x86_64-*-uefi": 41 }, "settings": { - "PARTITIONING": "custom_lvm", + "PARTITIONING": "custom_lvm_ext4", "ROOT_PASSWORD": "weakpassword", "STORE_HDD_1": "disk_%FLAVOR%_%MACHINE%.qcow2" } diff --git a/tests/disk_custom_blivet_lvm_ext4.pm b/tests/disk_custom_blivet_lvm_ext4.pm new file mode 100644 index 0000000..eb739bf --- /dev/null +++ b/tests/disk_custom_blivet_lvm_ext4.pm @@ -0,0 +1,43 @@ +use base "anacondatest"; +use strict; +use testapi; +use anaconda; + +sub run { + my $self = shift; + # Go to INSTALLATION DESTINATION and ensure the disk is selected. + # Because PARTITIONING starts with 'custom_blivet', this will select blivet-gui. + select_disks(); + assert_and_click "anaconda_spoke_done"; + + if (get_var("UEFI")) { + # if we're running on UEFI, we need esp + custom_blivet_add_partition(size => 512, mountpoint => '/boot/efi', filesystem => 'efi_filesystem'); + } + if (get_var("OFW")) { + custom_blivet_add_partition(size => 4, filesystem => 'ppc_prep_boot'); + } + + custom_blivet_add_partition(size => 512, mountpoint => '/boot', filesystem => 'ext4'); + # add new LVM device + custom_blivet_add_partition(devicetype => 'lvm'); + # select newly created LVM device for adding new partition + assert_and_click "anaconda_blivet_volumes_icon"; + # add lvm partition with ext4 and mount is as / + custom_blivet_add_partition(devicetype => 'lvm', filesystem => 'ext4', mountpoint => '/'); + + assert_and_click "anaconda_spoke_done"; + assert_and_click "anaconda_part_accept_changes"; + + # Anaconda hub + assert_screen "anaconda_main_hub", 300; # + +} + +sub test_flags { + return { fatal => 1 }; +} + +1; + +# vim: set sw=4 et: diff --git a/tests/disk_custom_lvm.pm b/tests/disk_custom_lvm.pm deleted file mode 100644 index be438d5..0000000 --- a/tests/disk_custom_lvm.pm +++ /dev/null @@ -1,36 +0,0 @@ -use base "anacondatest"; -use strict; -use testapi; -use anaconda; - -sub run { - my $self = shift; - # Go to INSTALLATION DESTINATION and ensure the disk is selected. - # Because PARTITIONING starts with 'custom_', this will select custom. - select_disks(); - assert_and_click "anaconda_spoke_done"; - - # Manual partitioning spoke should be displayed. Select LVM - # Partitioning scheme - custom_scheme_select("lvm"); - # Do 'automatic' partition creation - assert_and_click "anaconda_part_automatic"; - # Change file system to ext4 on root and boot partitions. - custom_change_fs("ext4", "root"); - custom_change_fs("ext4", "boot"); - # Confirm changes - assert_and_click "anaconda_spoke_done"; - assert_and_click "anaconda_part_accept_changes"; - - # Anaconda hub - assert_screen "anaconda_main_hub", 300; # - -} - -sub test_flags { - return { fatal => 1 }; -} - -1; - -# vim: set sw=4 et: diff --git a/tests/disk_custom_lvm_ext4.pm b/tests/disk_custom_lvm_ext4.pm new file mode 100644 index 0000000..da08aa0 --- /dev/null +++ b/tests/disk_custom_lvm_ext4.pm @@ -0,0 +1,36 @@ +use base "anacondatest"; +use strict; +use testapi; +use anaconda; + +sub run { + my $self = shift; + # Go to INSTALLATION DESTINATION and ensure the disk is selected. + # Because PARTITIONING starts with 'custom_', this will select custom. + select_disks(); + assert_and_click "anaconda_spoke_done"; + + # Manual partitioning spoke should be displayed. Select LVM + # Partitioning scheme + custom_scheme_select("lvm"); + # Do 'automatic' partition creation + assert_and_click "anaconda_part_automatic"; + # Change file system to ext4 on root and boot partitions. + custom_change_fs("ext4", "boot"); + custom_change_fs("ext4", "root"); + # Confirm changes + assert_and_click "anaconda_spoke_done"; + assert_and_click "anaconda_part_accept_changes"; + + # Anaconda hub + assert_screen "anaconda_main_hub", 300; # + +} + +sub test_flags { + return { fatal => 1 }; +} + +1; + +# vim: set sw=4 et: diff --git a/tests/disk_custom_lvm_ext4_postinstall.pm b/tests/disk_custom_lvm_ext4_postinstall.pm new file mode 100644 index 0000000..8f66a44 --- /dev/null +++ b/tests/disk_custom_lvm_ext4_postinstall.pm @@ -0,0 +1,32 @@ +use base "installedtest"; +use strict; +use testapi; + +sub run { + assert_screen "root_console"; + my $devboot = 'vda1'; + + if (get_var('OFW') || get_var('UEFI')) { + $devboot = 'vda2'; + } + # check that lvm is present: + validate_script_output "lvdisplay | grep 'LV Status'", sub { $_ =~ m/available/ }; + + # Check for standard LVM attributes, w - writable, i-inherited, a-active, o-open + validate_script_output "lvs -o lv_attr", sub { $_ =~ m/wi-ao/ }; + + # Check that the partitions are ext4. + validate_script_output "mount | grep /dev/$devboot", sub { $_ =~ m/on \/boot type ext4/ }; + + # There should be one partition in the LVM. + validate_script_output "mount | grep /dev/mapper", sub { $_ =~ m/on \/ type ext4/ }; + +} + +sub test_flags { + return { fatal => 1 }; +} + +1; + +# vim: set sw=4 et: