From 64ee3f84430652de3e3c24d9a0c91a1c29d1dd37 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Wed, 19 Feb 2003 14:03:19 +0000 Subject: - cleanup & simplify - handle raid on raid detection --- perl-install/detect_devices.pm | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) (limited to 'perl-install/detect_devices.pm') diff --git a/perl-install/detect_devices.pm b/perl-install/detect_devices.pm index 62e03e87d..e77b36090 100644 --- a/perl-install/detect_devices.pm +++ b/perl-install/detect_devices.pm @@ -632,11 +632,18 @@ sub raidAutoStartRaidtab { #- faking a raidtab, it seems to be working :-))) #- (choosing any inactive md) raid::inactivate_all(); - foreach (@parts) { - my $nb = find { !raid::is_active("md$_") } 0 .. raid::max_nb(); - output("/tmp/raidtab", "raiddev /dev/md$nb\n device " . devices::make($_->{device}) . "\n"); - run_program::run('raidstart', '-c', "/tmp/raidtab", devices::make("md$nb")); - } + my $detect_one = sub { + my ($device) = @_; + my $free_md = devices::make(find { !raid::is_active($_) } map { "md$_" } 0 .. raid::max_nb()); + output("/tmp/raidtab", "raiddev $free_md\n device " . devices::make($device) . "\n"); + log::l("raidAutoStartRaidtab: trying $device"); + run_program::run('raidstart', '-c', "/tmp/raidtab", $free_md); + }; + $detect_one->($_->{device}) foreach @parts; + + #- try again to detect RAID 10 + $detect_one->($_) foreach raid::active_mds(); + unlink "/tmp/raidtab"; } @@ -647,9 +654,10 @@ sub raidAutoStart { eval { modules::load('md') }; my %personalities = ('1' => 'linear', '2' => 'raid0', '3' => 'raid1', '4' => 'raid5'); raidAutoStartIoctl() or raidAutoStartRaidtab(@parts); - if (my @needed_perso = map { - if_(/^kmod: failed.*md-personality-(.)/ || - /^md: personality (.) is not loaded/, $personalities{$1}) } syslog()) { + foreach (1..2) { #- try twice for RAID 10 + my @needed_perso = map { + if_(/^kmod: failed.*md-personality-(.)/ || + /^md: personality (.) is not loaded/, $personalities{$1}) } syslog() or last; eval { modules::load(@needed_perso) }; raidAutoStartIoctl() or raidAutoStartRaidtab(@parts); } -- cgit v1.2.1