summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2003-02-19 14:03:19 +0000
committerPascal Rigaux <pixel@mandriva.com>2003-02-19 14:03:19 +0000
commit64ee3f84430652de3e3c24d9a0c91a1c29d1dd37 (patch)
treefc8379330a3c9a4ef13319d18000ffa255b95dd2 /perl-install
parentb0b1c6146ae1dab13cc791f521b1634a08bdb2ee (diff)
downloaddrakx-64ee3f84430652de3e3c24d9a0c91a1c29d1dd37.tar
drakx-64ee3f84430652de3e3c24d9a0c91a1c29d1dd37.tar.gz
drakx-64ee3f84430652de3e3c24d9a0c91a1c29d1dd37.tar.bz2
drakx-64ee3f84430652de3e3c24d9a0c91a1c29d1dd37.tar.xz
drakx-64ee3f84430652de3e3c24d9a0c91a1c29d1dd37.zip
- cleanup & simplify
- handle raid on raid detection
Diffstat (limited to 'perl-install')
-rw-r--r--perl-install/detect_devices.pm24
-rw-r--r--perl-install/fsedit.pm26
2 files changed, 33 insertions, 17 deletions
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);
}
diff --git a/perl-install/fsedit.pm b/perl-install/fsedit.pm
index 483e87000..3a16cc963 100644
--- a/perl-install/fsedit.pm
+++ b/perl-install/fsedit.pm
@@ -97,7 +97,6 @@ sub raids {
}
fs::get_major_minor(@parts);
- my %devname2part = map { $_->{dev} => { %$_, device => $_->{dev} } } read_proc_partitions_raw();
my @raids;
my @mdstat = cat_("/proc/mdstat");
@@ -113,24 +112,33 @@ sub raids {
my $chunks = $mdstat[$i+1] =~ /(\S+) chunks/ ? $1 : "64k";
my @raw_mdparts = map { /([^\[]+)/ } split ' ', $mdparts;
+
+ my $type = typeOfPart("md$nb");
+ log::l("RAID: found md$nb (raid $level) chunks $chunks ", if_($type, "type $type "), "with parts ", join(", ", @raw_mdparts));
+ $raids[$nb] = { 'chunk-size' => $chunks, type => $type || 0x83, raw_mdparts => \@raw_mdparts,
+ device => "md$nb", notFormatted => !$type, level => $level };
+ }
+
+ my %devname2part = map { $_->{dev} => { %$_, device => $_->{dev} } } read_proc_partitions_raw();
+ each_index {
+ my $raw_mdparts = delete $_->{raw_mdparts};
my @mdparts =
map {
my $mdpart = $devname2part{$_} || { device => $_ };
- if (my $part = find { is_same_hd($mdpart, $_) } @parts) {
- $part->{raid} = $nb;
+ if (my $part = find { is_same_hd($mdpart, $_) } @parts, @raids) {
+ $part->{raid} = $::i;
+ $part->{type} = 0xfd;
delete $part->{mntpoint};
$part;
} else {
#- forget it when not found? that way it won't break much... beurk.
();
}
- } @raw_mdparts;
+ } @$raw_mdparts;
+
+ $_->{disks} = \@mdparts;
+ } @raids;
- my $type = typeOfPart("md$nb");
- log::l("RAID: found md$nb (raid $level) chunks $chunks ", if_($type, "type $type "), "with parts ", join(", ", @raw_mdparts));
- $raids[$nb] = { 'chunk-size' => $chunks, type => $type || 0x83, disks => \@mdparts,
- device => "md$nb", notFormatted => !$type, level => $level };
- }
require raid;
raid::update(@raids);
\@raids;