diff options
Diffstat (limited to 'perl-install')
-rw-r--r-- | perl-install/fsedit.pm | 25 | ||||
-rw-r--r-- | perl-install/install_steps.pm | 2 |
2 files changed, 25 insertions, 2 deletions
diff --git a/perl-install/fsedit.pm b/perl-install/fsedit.pm index 504d643dd..ea6e6443b 100644 --- a/perl-install/fsedit.pm +++ b/perl-install/fsedit.pm @@ -387,11 +387,34 @@ sub allocatePartitions($$) { } sub auto_allocate { - my ($hds, $suggestions) = @_; + my ($hds, $suggestions, $raid) = @_; allocatePartitions($hds, $suggestions || $suggestions{simple}); + + auto_allocate_raids($hds, $suggestions, $raid) if $raid && $suggestions; + map { partition_table::assign_device_numbers($_) } @$hds; } +sub auto_allocate_raids { + my ($hds, $suggestions, $raid) = @_; + + my @raids = grep { isRAID($_) } get_fstab(@$hds) or return; + if (@raids) { + require raid; + my @mds = grep { $_->{hd} =~ /md/ } @$suggestions; + foreach my $md (@mds) { + my @raids_ = grep { !$md->{parts} || $md->{parts} =~ /\Q$_->{mntpoint}/ } @raids; + @raids = difference2(\@raids, \@raids_); + my $nb = raid::new($raid, @raids_); + my $part = $raid->[$nb]; + + my %h = %$md; + delete @h{'hd', 'parts'}; + put_in_hash($part, \%h); # mntpoint, level, chunk-size, type + } + } +} + sub undo_prepare($) { my ($hds) = @_; require Data::Dumper; diff --git a/perl-install/install_steps.pm b/perl-install/install_steps.pm index 47c008c8e..ab16217f8 100644 --- a/perl-install/install_steps.pm +++ b/perl-install/install_steps.pm @@ -192,7 +192,7 @@ sub doPartitionDisks { install_any::use_root_part($o->{fstab}, $p, $o->{prefix}); } if ($o->{partitioning}{auto_allocate}) { - fsedit::auto_allocate($o->{hds}, $o->{partitions}); + fsedit::auto_allocate($o->{hds}, $o->{partitions}, $o->{raid}{raid}); } } |