mirror of
https://github.com/webmin/webmin.git
synced 2026-03-20 16:50:24 +00:00
Spare / replacement disk improvements for RAID, thanks to Caspar Smit
This commit is contained in:
@@ -145,7 +145,7 @@ log_delete=Deleted RAID device $1
|
||||
log_mkfs=Created $1 filesystem on $2
|
||||
log_add=Added partition $2 to RAID device $1
|
||||
log_remove=Removed partition $2 from RAID device $1
|
||||
log_replace=Hot replaced partition $2 in RAID device $1 with a spare partition
|
||||
log_replace=Hot replaced partition $2 in RAID device $1 with spare partition $3
|
||||
log_grow=Grown RAID device $1 to a total of $2 disks
|
||||
log_convert_to_raid6=Converted RAID5 device $1 to a RAID6 device
|
||||
log_convert_to_raid5=Converted RAID6 device $1 to a RAID5 device
|
||||
|
||||
@@ -31,7 +31,7 @@ elsif ($action eq 'remove') {
|
||||
return &text('log_remove', "<tt>$object</tt>", "<tt>$p->{'disk'}</tt>");
|
||||
}
|
||||
elsif ($action eq 'replace') {
|
||||
return &text('log_replace', "<tt>$object</tt>", "<tt>$p->{'disk'}</tt>");
|
||||
return &text('log_replace', "<tt>$object</tt>", "<tt>$p->{'disk'}</tt>", "<tt>$p->{'disk2'}</tt>");
|
||||
}
|
||||
elsif ($action eq 'grow') {
|
||||
return &text('log_grow', "<tt>$object</tt>", "<tt>$p->{'disk'}</tt>");
|
||||
|
||||
@@ -562,14 +562,14 @@ if ($raid_mode eq "mdadm") {
|
||||
}
|
||||
}
|
||||
|
||||
# replace_partition(&raid, device)
|
||||
# Hot replaces a partition with a spare
|
||||
# replace_partition(&raid, device, spare)
|
||||
# Hot replaces a data disk with a spare disk
|
||||
sub replace_partition
|
||||
{
|
||||
if ($raid_mode eq "mdadm") {
|
||||
# Call mdadm commands to replace
|
||||
local $out = &backquote_logged(
|
||||
"mdadm --replace $_[0]->{'value'} $_[1] 2>&1");
|
||||
"mdadm --replace $_[0]->{'value'} $_[1] --with $_[2] 2>&1");
|
||||
&error(&text('emdadmreplace', "<tt>$out</tt>")) if ($?);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -114,11 +114,11 @@ elsif ($in{'remove_det'}) {
|
||||
&redirect("");
|
||||
}
|
||||
elsif ($in{'replace'}) {
|
||||
# Hot replace a member disk with a spare
|
||||
# Hot replace a data disk with a spare disk
|
||||
&lock_raid_files();
|
||||
&replace_partition($old, $in{'replacedisk'});
|
||||
&replace_partition($old, $in{'replacedisk'}, $in{'replacesparedisk'});
|
||||
&unlock_raid_files();
|
||||
&webmin_log("replace", undef, $old->{'value'}, { 'disk' => $in{'replacedisk'} } );
|
||||
&webmin_log("replace", undef, $old->{'value'}, { 'disk' => $in{'replacedisk'} , 'disk2' => $in{'replacesparedisk'} } );
|
||||
&redirect("");
|
||||
}
|
||||
elsif ($in{'convert_to_raid6'}) {
|
||||
|
||||
@@ -103,6 +103,7 @@ foreach $d (@devs) {
|
||||
}
|
||||
$rp .= "<br>\n";
|
||||
push(@rdisks, [ $d->{'value'}, $name ]);
|
||||
push(@datadisks, [ $d->{'value'}, $name ]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -120,6 +121,7 @@ foreach $d (@devs) {
|
||||
local $name = &mount::device_name($d->{'value'});
|
||||
$sp .= "$name<br>\n";
|
||||
push(@rdisks, [ $d->{'value'}, $name ]);
|
||||
push(@sparedisks, [ $d->{'value'}, $name ]);
|
||||
$sparescnt++;
|
||||
$newdisks++;
|
||||
push(@spares, [ "$newdisks", "+ $sparescnt" ]);
|
||||
@@ -165,8 +167,10 @@ if ($raid_mode eq "mdadm") {
|
||||
}
|
||||
if ($sparescnt > 0 && &get_mdadm_version() >= 3.3 && &supports_replace()) {
|
||||
@rdisks = sort { $a->[0] cmp $b->[0] } @rdisks;
|
||||
@spares = sort { $a->[0] cmp $b->[0] } @spares;
|
||||
push(@grid, &ui_submit($text{'view_replace'}, "replace")." ".
|
||||
&ui_select("replacedisk", undef, \@rdisks),
|
||||
&ui_select("replacedisk", undef, \@datadisks)." with ".
|
||||
&ui_select("replacesparedisk", undef, \@sparedisks),
|
||||
$text{'view_replacedesc'});
|
||||
}
|
||||
if ($sparescnt > 0 && $lvl != 10) {
|
||||
|
||||
Reference in New Issue
Block a user