Added a button to remove a detached partition, thanks to Caspar Smit.

This commit is contained in:
Jamie Cameron
2009-11-17 11:55:48 -08:00
parent f894a84b60
commit bf5f808a1d
5 changed files with 25 additions and 0 deletions

View File

@ -26,3 +26,5 @@ Spare groups can now be created and used when creating a RAID device.
When a RAID set is deleted, the superblocks on component devices are cleared in order to remove metadata about the old RAID set.
Added an option to skip initialization of metadata when creating a RAID device.
RAID 6 devices can now have spares, thanks to Caspar Smit.
---- Changes since 1.490 ----
Added a button to remove a detached partition, thanks to Caspar Smit.

View File

@ -91,6 +91,8 @@ view_delete=Delete RAID array
view_deletedesc=Click this button to totally remove this RAID device. Any data that it contains will almost certainly be lost!
view_remove=Remove partition:
view_removedesc=Select a partition that is part of the RAID device and click this button to remove it. This may cause data to be lost!
view_remove_det=Remove detached
view_remove_detdesc=Remove partitions that are already physically detached from the system.
view_grow=Grow RAID:
view_growdesc=Grow array (convert hot spares to active members)
view_state=RAID status

View File

@ -468,6 +468,18 @@ if ($raid_mode eq "mdadm") {
}
}
# remove_detached(&raid)
# Removes detached device(s) from some RAID set
sub remove_detached
{
if ($raid_mode eq "mdadm") {
# Call mdadm commands to remove
local $out = &backquote_logged(
"mdadm --manage $_[0]->{'value'} --remove detached 2>&1");
&error(&text('emdadremove', "<tt>$out</tt>")) if ($?);
}
}
# directive_lines(&directive, indent)
sub directive_lines
{

View File

@ -87,6 +87,13 @@ elsif ($in{'remove'}) {
&webmin_log("remove", undef, $old->{'value'}, { 'disk' => $in{'rdisk'} } );
&redirect("");
}
elsif ($in{'remove_det'}) {
# Remove detached disk(s) from a RAID set
&lock_raid_files();
&remove_detached($old);
&unlock_raid_files();
&redirect("");
}
elsif ($in{'mount'} || $in{'mountswap'}) {
# Re-direct to mount module
$type = $in{'mountswap'} ? "swap" :

View File

@ -152,6 +152,8 @@ if ($raid_mode eq "mdadm") {
push(@grid, &ui_submit($text{'view_remove'}, "remove")." ".
&ui_select("rdisk", undef, \@rdisks),
$text{'view_removedesc'});
push(@grid, &ui_submit($text{'view_remove_det'}, "remove_det"),
$text{'view_remove_detdesc'});
}
if ($sparescnt>0 && $lvl != 10) {
push(@grid, &ui_submit($text{'view_grow'}, "grow")." ".