Skip to content

Commit

Permalink
Extract commmon code for lvm configuration using REST API
Browse files Browse the repository at this point in the history
In encrypted_full_lvm and lvm+raid1 we have same code for the
configuration of the lvm, which we can move to the controller library.
  • Loading branch information
Rodion Iafarov committed Nov 26, 2020
1 parent 05b719c commit f0dc117
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -164,4 +164,18 @@ sub setup_raid {
}
}

sub setup_lvm {
my ($self, $args) = @_;

foreach my $vg (@{$args->{volume_groups}}) {
$self->add_volume_group($vg);
foreach my $lv (@{$vg->{logical_volumes}}) {
$self->add_logical_volume({
volume_group => $vg->{name},
logical_volume => $lv
});
}
}
}

1;
10 changes: 1 addition & 9 deletions tests/installation/partitioning/encrypted_full_lvm.pm
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,7 @@ sub run {
});
}

my $volume_group = $test_data->{lvm}->{volume_groups}[0];
$partitioner->add_volume_group($volume_group);

foreach my $logical_volume (@{$volume_group->{logical_volumes}}) {
$partitioner->add_logical_volume({
volume_group => $volume_group->{name},
logical_volume => $logical_volume
});
}
$partitioner->setup_lvm($test_data->{lvm});
$partitioner->accept_changes_and_press_next();
}

Expand Down
13 changes: 2 additions & 11 deletions tests/installation/partitioning/setup_raid1_lvm.pm
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,8 @@ sub run {

# Setup RAID as per test data (see YAML_SCHEDULE and YAML_TEST_DATA openQA variables)
$partitioner->setup_raid($test_data);

# Add volume groups and logical volumes as per test data
foreach my $vg (@{$test_data->{lvm}->{volume_groups}}) {
$partitioner->add_volume_group($vg);
foreach my $lv (@{$vg->{logical_volumes}}) {
$partitioner->add_logical_volume({
volume_group => $vg->{name},
logical_volume => $lv
});
}
}
# Setup lvm as per test data (see YAML_SCHEDULE and YAML_TEST_DATA openQA variables)
$partitioner->setup_lvm($test_data->{lvm});

$partitioner->accept_changes_and_press_next();
}
Expand Down

0 comments on commit f0dc117

Please sign in to comment.