Skip to content

Commit

Permalink
Add handling of logical volumes in Expert Partitioner
Browse files Browse the repository at this point in the history
  • Loading branch information
jknphy authored and Rodion Iafarov committed Nov 25, 2020
1 parent 668f310 commit 084d738
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ use strict;
use warnings;
use testapi;
use parent 'Installation::Partitioner::LibstorageNG::v4::ExpertPartitionerController';
use Installation::Partitioner::LibstorageNG::v4_3::AddLogicalVolumePage;
use Installation::Partitioner::LibstorageNG::v4_3::AddVolumeGroupPage;
use Installation::Partitioner::LibstorageNG::v4_3::ClonePartitionsDialog;
use Installation::Partitioner::LibstorageNG::v4_3::ExpertPartitionerPage;
Expand All @@ -34,9 +35,14 @@ sub new {
sub init {
my ($self, $args) = @_;
$self->SUPER::init($args);
$self->{ExpertPartitionerPage} = Installation::Partitioner::LibstorageNG::v4_3::ExpertPartitionerPage->new({app => YuiRestClient::get_app()});
$self->{ClonePartitionsDialog} = Installation::Partitioner::LibstorageNG::v4_3::ClonePartitionsDialog->new({app => YuiRestClient::get_app()});
$self->{AddVolumeGroupPage} = Installation::Partitioner::LibstorageNG::v4_3::AddVolumeGroupPage->new({app => YuiRestClient::get_app()});
$self->{ExpertPartitionerPage} = Installation::Partitioner::LibstorageNG::v4_3::ExpertPartitionerPage->new({app => YuiRestClient::get_app()});
$self->{ClonePartitionsDialog} = Installation::Partitioner::LibstorageNG::v4_3::ClonePartitionsDialog->new({app => YuiRestClient::get_app()});
$self->{AddVolumeGroupPage} = Installation::Partitioner::LibstorageNG::v4_3::AddVolumeGroupPage->new({app => YuiRestClient::get_app()});
$self->{AddLogicalVolumePage} = Installation::Partitioner::LibstorageNG::v4_3::AddLogicalVolumePage->new({app => YuiRestClient::get_app()});

$self->{EditPartitionSizePage} = Installation::Partitioner::NewPartitionSizePage->new({
custom_size_shortcut => 'alt-t'
});

return $self;
}
Expand All @@ -52,6 +58,11 @@ sub get_clone_partition_dialog {
}


sub get_add_logical_volume_page {
my ($self) = @_;
return $self->{AddLogicalVolumePage};
}

sub add_partition_on_gpt_disk {
my ($self, $args) = @_;
$self->get_expert_partitioner_page()->select_disk($args->{disk});
Expand Down Expand Up @@ -99,4 +110,17 @@ sub add_volume_group {
$self->get_add_volume_group_page()->press_next_button();
}

sub add_logical_volume {
my ($self, $args) = @_;
my $lv = $args->{logical_volume};
$self->get_expert_partitioner_page()->select_volume_group($args->{volume_group});
$self->get_expert_partitioner_page()->press_add_logical_volume_button();
$self->get_add_logical_volume_page()->set_logical_volume_name($lv->{name});
$self->get_add_logical_volume_page()->press_next_button();
$self->set_new_partition_size($lv->{size});
$self->get_add_logical_volume_page()->select_role($lv->{role});
$self->get_add_logical_volume_page()->press_next_button();
$self->_finish_partition_creation;
}

1;
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,16 @@ sub new {
sub init {
my $self = shift;

$self->{btn_add_partition} = $self->{app}->button({id => '"Y2Partitioner::Widgets::PartitionAddButton"'});
$self->{btn_lvm_add_vg} = $self->{app}->button({id => '"Y2Partitioner::Widgets::LvmVgAddButton"'});
$self->{btn_lvm_add_lv} = $self->{app}->button({id => '"Y2Partitioner::Widgets::LvmLvAddButton"'});
$self->{btn_add_raid} = $self->{app}->button({id => '"Y2Partitioner::Widgets::MdAddButton"'});
$self->{btn_accept} = $self->{app}->button({label => 'Accept'});
$self->{menu_bar} = $self->{app}->menucollection({id => 'menu_bar'});
$self->{tbl_devices} = $self->{app}->table({id => '"Y2Partitioner::Widgets::ConfigurableBlkDevicesTable"'});
$self->{tbl_lvm_devices} = $self->{app}->table({id => '"Y2Partitioner::Widgets::LvmDevicesTable"'});
$self->{tree_system_view} = $self->{app}->tree({id => '"Y2Partitioner::Widgets::OverviewTree"'});
$self->{btn_add_partition} = $self->{app}->button({id => '"Y2Partitioner::Widgets::PartitionAddButton"'});
$self->{btn_lvm_add_vg} = $self->{app}->button({id => '"Y2Partitioner::Widgets::LvmVgAddButton"'});
$self->{btn_lvm_add_lv} = $self->{app}->button({id => '"Y2Partitioner::Widgets::LvmLvAddButton"'});
$self->{btn_add_raid} = $self->{app}->button({id => '"Y2Partitioner::Widgets::MdAddButton"'});
$self->{btn_accept} = $self->{app}->button({label => 'Accept'});
$self->{menu_bar} = $self->{app}->menucollection({id => 'menu_bar'});
$self->{tbl_devices} = $self->{app}->table({id => '"Y2Partitioner::Widgets::ConfigurableBlkDevicesTable"'});
$self->{tbl_lvm_devices} = $self->{app}->table({id => '"Y2Partitioner::Widgets::LvmDevicesTable"'});
$self->{tree_system_view} = $self->{app}->tree({id => '"Y2Partitioner::Widgets::OverviewTree"'});
$self->{btn_add_logical_volume} = $self->{app}->tree({id => '"Y2Partitioner::Widgets::LvmLvAddButton"'});

return $self;
}
Expand Down Expand Up @@ -106,4 +107,9 @@ sub select_lvm {
return $self->select_item_in_system_view_table('LVM Volume Groups');
}

sub select_volume_group {
my ($self, $vg) = @_;
return $self->select_item_in_system_view_table('LVM Volume Groups|' . $vg);
}

1;

0 comments on commit 084d738

Please sign in to comment.