summaryrefslogtreecommitdiffstats
path: root/perl-install/raid.pm
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install/raid.pm')
-rw-r--r--perl-install/raid.pm21
1 files changed, 19 insertions, 2 deletions
diff --git a/perl-install/raid.pm b/perl-install/raid.pm
index 8b4fb4c8e..5ee6f9c9d 100644
--- a/perl-install/raid.pm
+++ b/perl-install/raid.pm
@@ -27,12 +27,15 @@ sub new($$) {
my $nb = @$raid;
$raid->[$nb] = { 'chunk-size' => "64k", type => 0x83, disks => [ $part ], device => "md$nb", notFormatted => 1 };
$part->{raid} = $nb;
+ delete $part->{mntpoint};
+ $nb;
}
sub add($$$) {
my ($raid, $part, $nb) = @_; $nb = nb($nb);
$raid->[$nb]{isMounted} and die _("Can't add a partition to _formatted_ RAID md%d", $nb);
$part->{raid} = $nb;
+ delete $part->{mntpoint};
push @{$raid->[$nb]{disks}}, $part;
}
@@ -40,6 +43,7 @@ sub delete($$) {
my ($raid, $nb) = @_;
$nb = nb($nb);
+ run_program::run("raidstop", devices::make($raid->[$nb]{device}));
delete $_->{raid} foreach @{$raid->[$nb]{disks}};
$raid->[$nb] = undef;
}
@@ -109,8 +113,8 @@ chunk-size $_->{'chunk-size'}
persistent-superblock 1
EOF
print F "nr-raid-disks ", int @{$_->{disks}};
- map_index {
- print F " device /dev/$_->{device}";
+ map_index {
+ print F " device ", devices::make($_->{device});
print F " raid-disk $::i";
} @{$_->{disks}};
}
@@ -130,6 +134,9 @@ sub format_part($$) {
my ($raid, $part) = @_;
make($raid->{raid}, $part) if is($part);
fs::format_part($part);
+ if (is($part)) {
+ $_->{isFormatted} = 1 foreach @{$part->{disks}};
+ }
}
sub verify($) {
@@ -140,4 +147,14 @@ sub verify($) {
}
}
+sub prepare_prefixed($$) {
+ my ($raid, $prefix) = @_;
+ $raid && $raid->{raid} or return;
+
+ eval { commands::cp("-f", "/etc/raidtab", "$prefix/etc/raidtab") };
+ foreach (@{$raid->{raid}}) {
+ devices::make("$prefix/dev/$_->{device}") foreach @{$_->{disks}};
+ }
+}
+
1;