summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2005-03-24 11:43:54 +0000
committerPascal Rigaux <pixel@mandriva.com>2005-03-24 11:43:54 +0000
commitd186a76fd2fb10ab18cbed744f7066fe4d019225 (patch)
tree89894dab8c60174c5eb12caeb1089fb7f34a4977
parent503849761ece4d878a03044318f24f77939c4a25 (diff)
downloaddrakx-d186a76fd2fb10ab18cbed744f7066fe4d019225.tar
drakx-d186a76fd2fb10ab18cbed744f7066fe4d019225.tar.gz
drakx-d186a76fd2fb10ab18cbed744f7066fe4d019225.tar.bz2
drakx-d186a76fd2fb10ab18cbed744f7066fe4d019225.tar.xz
drakx-d186a76fd2fb10ab18cbed744f7066fe4d019225.zip
ensure we use/propose a free md when creating a new one
-rw-r--r--perl-install/raid.pm7
1 files changed, 6 insertions, 1 deletions
diff --git a/perl-install/raid.pm b/perl-install/raid.pm
index 273aca6ca..d52956935 100644
--- a/perl-install/raid.pm
+++ b/perl-install/raid.pm
@@ -25,7 +25,7 @@ sub new {
my $md_part = { %opts };
add2hash_($md_part, { 'chunk-size' => '64', disks => [],
fs_type => 'ext3',
- device => 'md' . int(@$raids),
+ device => first(free_mds($raids)),
notFormatted => 1, level => 1 });
push @$raids, $md_part;
foreach (@{$md_part->{disks}}) {
@@ -158,6 +158,11 @@ sub inactive_mds() {
map { if_(/^(md\d+)\s*:\s*inactive/, $1) } cat_("/proc/mdstat");
}
+sub free_mds {
+ my ($raids) = @_;
+ difference2([ map { "md$_" } 0 .. raid::max_nb() ], [ map { $_->{device} } @$raids ]);
+}
+
sub detect_during_install {
my (@parts) = @_;
detect_during_install_once(@parts);