From d186a76fd2fb10ab18cbed744f7066fe4d019225 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Thu, 24 Mar 2005 11:43:54 +0000 Subject: ensure we use/propose a free md when creating a new one --- perl-install/raid.pm | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'perl-install/raid.pm') 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); -- cgit v1.2.1