Create a test to resize LVM partitions using Blivet.
@ -8,7 +8,7 @@ use Exporter;
|
|||||||
use testapi;
|
use testapi;
|
||||||
use utils;
|
use utils;
|
||||||
|
|
||||||
our @EXPORT = qw/select_disks custom_scheme_select custom_blivet_add_partition custom_change_type custom_change_fs custom_change_device custom_delete_part get_full_repo get_mirrorlist_url/;
|
our @EXPORT = qw/select_disks custom_scheme_select custom_blivet_add_partition custom_blivet_format_partition custom_blivet_resize_partition custom_change_type custom_change_fs custom_change_device custom_delete_part get_full_repo get_mirrorlist_url/;
|
||||||
|
|
||||||
sub select_disks {
|
sub select_disks {
|
||||||
# Handles disk selection. Has one optional argument - number of
|
# Handles disk selection. Has one optional argument - number of
|
||||||
@ -174,6 +174,52 @@ sub custom_blivet_add_partition {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub custom_blivet_format_partition {
|
||||||
|
# This subroutine formats a selected partition. To use it, you must select the
|
||||||
|
# partition by other means before you format it using this routine.
|
||||||
|
# You have to create a needle for any non-existing filesystem that is
|
||||||
|
# passed via the $type, such as anaconda_blivet_part_select_ext4.
|
||||||
|
my %args = @_;
|
||||||
|
# Start editing the partition and select the Format option
|
||||||
|
assert_and_click "anaconda_blivet_part_edit";
|
||||||
|
assert_and_click "anaconda_blivet_part_format";
|
||||||
|
# Select the appropriate filesystem type.
|
||||||
|
assert_and_click "anaconda_blivet_part_drop_select";
|
||||||
|
assert_and_click "anaconda_blivet_part_select_$args{type}";
|
||||||
|
wait_still_screen 2;
|
||||||
|
# Fill in the label if needed.
|
||||||
|
send_key "tab";
|
||||||
|
if ($args{label}) {
|
||||||
|
type_very_safely $args{label};
|
||||||
|
}
|
||||||
|
# Fill in the mountpoint.
|
||||||
|
send_key "tab";
|
||||||
|
type_very_safely $args{mountpoint};
|
||||||
|
assert_and_click "anaconda_blivet_part_format_button";
|
||||||
|
}
|
||||||
|
|
||||||
|
sub custom_blivet_resize_partition {
|
||||||
|
# This subroutine resizes the selected (active) partition to a given value. Note, that
|
||||||
|
# if the selected value is bigger than the available space, it will only be
|
||||||
|
# resized to fill up the available space no matter the number.
|
||||||
|
# This routine cannot will not be able to select a particular partition!!!
|
||||||
|
my %args = @_;
|
||||||
|
# Start editing the partition and select the Resize option
|
||||||
|
assert_and_click "anaconda_blivet_part_edit";
|
||||||
|
assert_and_click "anaconda_blivet_part_resize";
|
||||||
|
# Select the appropriate units. Note, that there must a be needle existing
|
||||||
|
# for each possible unit that you might want to use, such as
|
||||||
|
# "anaconda_blivet_size_unit_gib".
|
||||||
|
assert_and_click "anaconda_blivet_part_drop_select";
|
||||||
|
assert_and_click "anaconda_blivet_size_unit_$args{units}";
|
||||||
|
# Move back to the value field.
|
||||||
|
send_key "shift-tab";
|
||||||
|
# Type in the new size.
|
||||||
|
type_very_safely $args{size};
|
||||||
|
assert_and_click "anaconda_blivet_part_resize_button";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
sub custom_change_type {
|
sub custom_change_type {
|
||||||
# Used to set different device types for specified partition (e.g.
|
# Used to set different device types for specified partition (e.g.
|
||||||
# RAID). Should be called when custom partitioning spoke is
|
# RAID). Should be called when custom partitioning spoke is
|
||||||
|
@ -0,0 +1,16 @@
|
|||||||
|
{
|
||||||
|
"properties": [],
|
||||||
|
"tags": [
|
||||||
|
"anaconda_blivet_part_fs_select",
|
||||||
|
"anaconda_blivet_part_drop_select"
|
||||||
|
],
|
||||||
|
"area": [
|
||||||
|
{
|
||||||
|
"xpos": 657,
|
||||||
|
"ypos": 313,
|
||||||
|
"width": 18,
|
||||||
|
"height": 15,
|
||||||
|
"type": "match"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
After Width: | Height: | Size: 64 KiB |
@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"properties": [],
|
||||||
|
"tags": [
|
||||||
|
"anaconda_blivet_part_edit"
|
||||||
|
],
|
||||||
|
"area": [
|
||||||
|
{
|
||||||
|
"xpos": 312,
|
||||||
|
"ypos": 247,
|
||||||
|
"width": 19,
|
||||||
|
"height": 19,
|
||||||
|
"type": "match"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
After Width: | Height: | Size: 60 KiB |
@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"properties": [],
|
||||||
|
"tags": [
|
||||||
|
"anaconda_blivet_part_format"
|
||||||
|
],
|
||||||
|
"area": [
|
||||||
|
{
|
||||||
|
"xpos": 329,
|
||||||
|
"ypos": 325,
|
||||||
|
"width": 56,
|
||||||
|
"height": 15,
|
||||||
|
"type": "match"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
After Width: | Height: | Size: 73 KiB |
@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"properties": [],
|
||||||
|
"tags": [
|
||||||
|
"anaconda_blivet_part_format_button"
|
||||||
|
],
|
||||||
|
"area": [
|
||||||
|
{
|
||||||
|
"xpos": 629,
|
||||||
|
"ypos": 496,
|
||||||
|
"width": 49,
|
||||||
|
"height": 16,
|
||||||
|
"type": "match"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
After Width: | Height: | Size: 63 KiB |
@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
"area": [
|
||||||
|
{
|
||||||
|
"xpos": 320,
|
||||||
|
"ypos": 419,
|
||||||
|
"type": "match",
|
||||||
|
"width": 171,
|
||||||
|
"height": 24
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"properties": [],
|
||||||
|
"tags": [
|
||||||
|
"LANGUAGE-english",
|
||||||
|
"anaconda_blivet_part_fs",
|
||||||
|
"anaconda_blivet_part_fs_ext4_selected"
|
||||||
|
]
|
||||||
|
}
|
After Width: | Height: | Size: 69 KiB |
@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"properties": [],
|
||||||
|
"tags": [
|
||||||
|
"anaconda_blivet_part_resize"
|
||||||
|
],
|
||||||
|
"area": [
|
||||||
|
{
|
||||||
|
"xpos": 331,
|
||||||
|
"ypos": 298,
|
||||||
|
"width": 43,
|
||||||
|
"height": 19,
|
||||||
|
"type": "match"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
After Width: | Height: | Size: 74 KiB |
@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"properties": [],
|
||||||
|
"tags": [
|
||||||
|
"anaconda_blivet_part_resize_button"
|
||||||
|
],
|
||||||
|
"area": [
|
||||||
|
{
|
||||||
|
"xpos": 718,
|
||||||
|
"ypos": 434,
|
||||||
|
"width": 41,
|
||||||
|
"height": 16,
|
||||||
|
"type": "match"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
After Width: | Height: | Size: 64 KiB |
@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"properties": [],
|
||||||
|
"tags": [
|
||||||
|
"anaconda_blivet_part_root_inactive"
|
||||||
|
],
|
||||||
|
"area": [
|
||||||
|
{
|
||||||
|
"xpos": 559,
|
||||||
|
"ypos": 186,
|
||||||
|
"width": 45,
|
||||||
|
"height": 16,
|
||||||
|
"type": "match"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
After Width: | Height: | Size: 70 KiB |
@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"properties": [],
|
||||||
|
"tags": [
|
||||||
|
"anaconda_blivet_part_select_ext4"
|
||||||
|
],
|
||||||
|
"area": [
|
||||||
|
{
|
||||||
|
"xpos": 519,
|
||||||
|
"ypos": 315,
|
||||||
|
"width": 31,
|
||||||
|
"height": 17,
|
||||||
|
"type": "match"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
After Width: | Height: | Size: 69 KiB |
@ -0,0 +1,16 @@
|
|||||||
|
{
|
||||||
|
"area": [
|
||||||
|
{
|
||||||
|
"xpos": 714,
|
||||||
|
"ypos": 314,
|
||||||
|
"width": 28,
|
||||||
|
"height": 17,
|
||||||
|
"type": "match"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"properties": [],
|
||||||
|
"tags": [
|
||||||
|
"anaconda_blivet_size_unit_gib",
|
||||||
|
"anaconda_blivet_size_unit_GiB"
|
||||||
|
]
|
||||||
|
}
|
Before Width: | Height: | Size: 66 KiB After Width: | Height: | Size: 66 KiB |
After Width: | Height: | Size: 66 KiB |
53
tests/disk_custom_blivet_resize.pm
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
use base "anacondatest";
|
||||||
|
use strict;
|
||||||
|
use testapi;
|
||||||
|
use anaconda;
|
||||||
|
use utils;
|
||||||
|
|
||||||
|
sub run {
|
||||||
|
my $self = shift;
|
||||||
|
# Navigate to "Installation destionation" and select blivet-gui
|
||||||
|
# to manipulate the partitions. This will be automatically
|
||||||
|
# done using the following method, because PARTITIONING starts
|
||||||
|
# with "custom_blivet".
|
||||||
|
select_disks();
|
||||||
|
assert_and_click "anaconda_spoke_done";
|
||||||
|
|
||||||
|
# The following procedure will use Blivet to resize the root partition from
|
||||||
|
# a previous Linux installation and prepare the disk for new installation
|
||||||
|
# which will be then followed through.
|
||||||
|
|
||||||
|
# Partitioning starts out of the LVM on VD1. We will use it to recreate
|
||||||
|
# the "/boot" partition in there.
|
||||||
|
custom_blivet_format_partition(type => 'ext4', label => 'boot', mountpoint => '/boot');
|
||||||
|
|
||||||
|
# Select the LVM root partition, resize it, and format it.
|
||||||
|
assert_and_click "anaconda_blivet_volumes_icon";
|
||||||
|
if (check_screen "anaconda_blivet_part_root_inactive") {
|
||||||
|
# If the root partition is not active, click on it to
|
||||||
|
# activate it.
|
||||||
|
assert_and_click "anaconda_blivet_part_root_inactive";
|
||||||
|
}
|
||||||
|
custom_blivet_resize_partition(size => '13', units => 'GiB');
|
||||||
|
|
||||||
|
# Now format the resized root partition
|
||||||
|
custom_blivet_format_partition(type => 'ext4', label => 'root', mountpoint => '/');
|
||||||
|
|
||||||
|
# Select the newly created free space
|
||||||
|
assert_and_click "anaconda_blivet_free_space";
|
||||||
|
|
||||||
|
# Create a partition and format it.
|
||||||
|
custom_blivet_add_partition(filesystem => 'ext4', mountpoint => '/home');
|
||||||
|
|
||||||
|
# Close the spoke.
|
||||||
|
assert_and_click "anaconda_spoke_done";
|
||||||
|
|
||||||
|
# Confirm changes
|
||||||
|
assert_and_click "anaconda_part_accept_changes";
|
||||||
|
}
|
||||||
|
|
||||||
|
sub test_flags {
|
||||||
|
return { fatal => 1 };
|
||||||
|
}
|
||||||
|
|
||||||
|
1;
|