diff options
author | Pascal Rigaux <pixel@mandriva.com> | 1999-11-09 15:59:39 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 1999-11-09 15:59:39 +0000 |
commit | ab18bd5253ea6b8edcc72f176566505e9ba84390 (patch) | |
tree | 78f959fa158974381055d796e23b7a320aa83c52 /perl-install/raid.pm | |
parent | c3b5ff8158ed25327e34de957573b8c17b80b0eb (diff) | |
download | drakx-backup-do-not-use-ab18bd5253ea6b8edcc72f176566505e9ba84390.tar drakx-backup-do-not-use-ab18bd5253ea6b8edcc72f176566505e9ba84390.tar.gz drakx-backup-do-not-use-ab18bd5253ea6b8edcc72f176566505e9ba84390.tar.bz2 drakx-backup-do-not-use-ab18bd5253ea6b8edcc72f176566505e9ba84390.tar.xz drakx-backup-do-not-use-ab18bd5253ea6b8edcc72f176566505e9ba84390.zip |
no_comment
Diffstat (limited to 'perl-install/raid.pm')
-rw-r--r-- | perl-install/raid.pm | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/perl-install/raid.pm b/perl-install/raid.pm index 45d58c750..8b4fb4c8e 100644 --- a/perl-install/raid.pm +++ b/perl-install/raid.pm @@ -30,7 +30,7 @@ sub new($$) { } sub add($$$) { - my ($raid, $part, $nb) = @_; + 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; push @{$raid->[$nb]{disks}}, $part; @@ -44,6 +44,16 @@ sub delete($$) { $raid->[$nb] = undef; } +sub changeNb($$$) { + my ($raid, $oldnb, $newnb) = @_; + if ($oldnb != $newnb) { + ($raid->[$newnb], $raid->[$oldnb]) = ($raid->[$oldnb], undef); + $raid->[$newnb]{device} = "md$newnb"; + $_->{raid} = $newnb foreach @{$raid->[$newnb]{disks}}; + } + $newnb; +} + sub removeDisk($$) { my ($raid, $part) = @_; my $nb = nb($part->{raid}); @@ -78,9 +88,11 @@ sub updateIsFormatted($) { $part->{isFormatted} = and_ map { $_->{isFormatted} } @{$part->{disks}}; $part->{notFormatted} = and_ map { $_->{notFormatted} } @{$part->{disks}}; } -sub update($) { - &updateSize; - &updateIsFormatted; +sub update { + foreach (@_) { + updateSize($_); + updateIsFormatted($_); + } } sub write($) { @@ -123,7 +135,7 @@ sub format_part($$) { sub verify($) { my ($raid) = @_; $raid && $raid->{raid} or return; - foreach (@{$raid->{raid}}) { + foreach (grep {$_} @{$raid->{raid}}) { @{$_->{disks}} >= ($_->{level} =~ /4|5/ ? 3 : 2) or die _("Not enough partitions for RAID level %d\n", $_->{level}); } } |