summaryrefslogtreecommitdiffstats
path: root/perl-install/raid.pm
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>1999-11-09 12:18:39 +0000
committerPascal Rigaux <pixel@mandriva.com>1999-11-09 12:18:39 +0000
commitbc32ccb59baadd5e55488ed76c43f34944e82b28 (patch)
treed21bf2baffeb59e6890e840fa0afc4201a2cec88 /perl-install/raid.pm
parent844cead8bad8e2e4d7619abd39cf0351f9b97bc6 (diff)
downloaddrakx-backup-do-not-use-bc32ccb59baadd5e55488ed76c43f34944e82b28.tar
drakx-backup-do-not-use-bc32ccb59baadd5e55488ed76c43f34944e82b28.tar.gz
drakx-backup-do-not-use-bc32ccb59baadd5e55488ed76c43f34944e82b28.tar.bz2
drakx-backup-do-not-use-bc32ccb59baadd5e55488ed76c43f34944e82b28.tar.xz
drakx-backup-do-not-use-bc32ccb59baadd5e55488ed76c43f34944e82b28.zip
no_comment
Diffstat (limited to 'perl-install/raid.pm')
-rw-r--r--perl-install/raid.pm19
1 files changed, 19 insertions, 0 deletions
diff --git a/perl-install/raid.pm b/perl-install/raid.pm
index 7cc2eb7d6..45d58c750 100644
--- a/perl-install/raid.pm
+++ b/perl-install/raid.pm
@@ -9,6 +9,7 @@ use strict;
use common qw(:common :functional);
use run_program;
use devices;
+use commands;
use fs;
sub nb($) {
@@ -63,6 +64,15 @@ sub updateSize($) {
};
}
+sub module($) {
+ my ($part) = @_;
+ my $mod = $part->{level};
+
+ $mod = 5 if $mod eq "4";
+ $mod = "raid$mod" if $mod =~ /^\d+$/;
+ $mod;
+}
+
sub updateIsFormatted($) {
my ($part) = @_;
$part->{isFormatted} = and_ map { $_->{isFormatted} } @{$part->{disks}};
@@ -97,6 +107,7 @@ EOF
sub make($$) {
my ($raid, $part) = @_;
my $dev = devices::make($part->{device});
+ eval { commands::modprobe(module($part)) };
run_program::run("raidstop", $dev);
&write($raid, "/etc/raidtab");
run_program::run("mkraid", "--really-force", $dev);
@@ -109,4 +120,12 @@ sub format_part($$) {
fs::format_part($part);
}
+sub verify($) {
+ my ($raid) = @_;
+ $raid && $raid->{raid} or return;
+ foreach (@{$raid->{raid}}) {
+ @{$_->{disks}} >= ($_->{level} =~ /4|5/ ? 3 : 2) or die _("Not enough partitions for RAID level %d\n", $_->{level});
+ }
+}
+
1;