From ef94ffc7836beb6bc297106851749441e0fb2254 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Sun, 7 Jul 2002 22:45:48 +0000 Subject: great new raidAutoStartRaidtab allowing to handle existing software raids even when RAID_AUTORUN is not supported by kernel (which is the case for us since md.o is a not builtin the kernel) --- perl-install/detect_devices.pm | 28 ++++++++++++++++++++-------- 1 file changed, 20 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 54f803756..cabc7807c 100644 --- a/perl-install/detect_devices.pm +++ b/perl-install/detect_devices.pm @@ -10,6 +10,7 @@ use vars qw($pcitable_addons $usbtable_addons); use log; use common; use devices; +use run_program; use c; #-##################################################################################### @@ -551,22 +552,33 @@ sub hasMousePS2 { } sub raidAutoStartIoctl { - eval { modules::load('md') }; - my $md = devices::make("md0"); local *F; - sysopen F, $md, 2 or return; + sysopen F, devices::make("md0"), 2 or return; ioctl F, 2324, 0; } +sub raidAutoStartRaidtab { + my (@parts) = @_; + #- faking a raidtab, it seems to be working :-))) + #- (choosing md0, but it works for the others!) + foreach (@parts) { + output("/etc/raidtab", "raiddev /dev/md0\n device " . devices::make($_->{device}) . "\n"); + run_program::run('raidstart', devices::make("md0")); + } +} + sub raidAutoStart { + my (@parts) = @_; + log::l("raidAutoStart"); + eval { modules::load('md') }; my %personalities = ( '1' => 'linear', '2' => 'raid0', '3' => 'raid1', '4' => 'raid5' ); - raidAutoStartIoctl() or log::l("warning, RAID_AUTORUN not supported by kernel"), return; - if (my @needed_perso = map { if_(/^kmod: failed.*md-personality-(.)/, $personalities{$1}) } syslog()) { + raidAutoStartIoctl() or raidAutoStartRaidtab(@parts); + if (my @needed_perso = map { + if_(/^kmod: failed.*md-personality-(.)/ || + /^md: personality (.) is not loaded/, $personalities{$1}) } syslog()) { log::l("RAID: autostart needs personality from $_"), eval { modules::load(@needed_perso) }; - return raidAutoStartIoctl(); - } else { - 1; + raidAutoStartIoctl() or raidAutoStartRaidtab(@parts); } } -- cgit v1.2.1