Added a button to remove a detached partition, thanks to Caspar Smit.
authorJamie Cameron <jcameron@webmin.com>
Tue, 17 Nov 2009 19:55:48 +0000 (11:55 -0800)
committerJamie Cameron <jcameron@webmin.com>
Tue, 17 Nov 2009 19:55:48 +0000 (11:55 -0800)
raid/CHANGELOG
raid/lang/en
raid/raid-lib.pl
raid/save_raid.cgi
raid/view_raid.cgi

index 1fb497f..087a98e 100644 (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.
index 6121935..f84b7c9 100644 (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
index d58fd3e..3f8a013 100755 (executable)
@@ -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
 {
index 11474f4..a4821a6 100755 (executable)
@@ -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" :
index 7df7f0f..3008b91 100755 (executable)
@@ -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")." ".