Converted all pages to use the new Webmin UI library, for a more consistent look.
Added a confirmation page before deleting a RAID array.
Create /dev/md* device file if missing when creating a RAID set.
+---- Changes since 1.450 ----
+Added a button for changing the number of active devices in a RAID 5 or 6 set, thanks to Diego Zuccato.
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_grow=Grow RAID:
+view_growdesc=Grow array (convert hot spares to active members)
view_state=RAID status
view_rebuild=Rebuilding progress
view_newmount=Mount RAID on:
emdadmstop=<tt>mdadm</tt> in <tt>--stop</tt> mode failed : $1
emdadmcreate=<tt>mdadm</tt> in <tt>--create</tt> mode failed : $1
emdadmadd=<tt>mdadm</tt> in <tt>--manage --add</tt> mode failed : $1
+emdadmgrow=<tt>mdadm</tt> in <tt>--grow</tt> mode failed : $1
emdadmremove=<tt>mdadm</tt> in <tt>--manage --remove</tt> mode failed : $1
emdadmfail=<tt>mdadm</tt> in <tt>--manage --fail</tt> mode failed : $1
}
}
+# grow(&raid, totaldisks)
+# Grows a RAID set to contain totaldisks active partitions
+sub grow
+{
+if ($raid_mode eq "mdadm") {
+ # Call mdadm command to add
+ $cmd="mdadm --grow $_[0]->{'value'} -n $_[1] 2>&1";
+ local $out = &backquote_logged(
+ $cmd);
+ &error(&text('emdadmgrow', "<tt>'$cmd' -> $out</tt>")) if ($?);
+ }
+}
+
# remove_partition(&raid, device)
# Removes a device from some RAID set, both in the config file and for real
sub remove_partition
&webmin_log("add", undef, $old->{'value'}, { 'disk' => $in{'disk'} } );
&redirect("");
}
+elsif ($in{'grow'}) {
+ # Grow the array
+ &lock_raid_files();
+ &grow($old, $in{'ndisk'});
+ &unlock_raid_files();
+ &webmin_log("grow", undef, $old->{'value'}, { 'disk' => $in{'ndisk'} } );
+ &redirect("");
+ }
elsif ($in{'remove'}) {
# Remove a disk from a RAID set
&lock_raid_files();
# Display partitions in RAID
$rp = undef;
-foreach $d (&find('device', $raid->{'members'})) {
+@devs = &find('device', $raid->{'members'});
+foreach $d (@devs) {
if (&find('raid-disk', $d->{'members'}) ||
&find('parity-disk', $d->{'members'})) {
local $name = &mount::device_name($d->{'value'});
# Display spare partitions
$sp = undef;
-foreach $d (&find('device', $raid->{'members'})) {
+$sparescnt = 0;
+$newdisks = @rdisks;
+@spares = ( );
+foreach $d (@devs) {
if (&find('spare-disk', $d->{'members'})) {
local $name = &mount::device_name($d->{'value'});
$sp .= "$name<br>\n";
push(@rdisks, [ $d->{'value'}, $name ]);
+ $sparescnt++;
+ $newdisks++;
+ push(@spares, [ "$newdisks", "+ $sparescnt" ]);
}
}
if ($sp) {
&ui_select("rdisk", undef, \@rdisks),
$text{'view_removedesc'});
}
+ if ($sparescnt>0) {
+ push(@grid, &ui_submit($text{'view_grow'}, "grow")." ".
+ &ui_select("ndisk", undef, \@spares),
+ $text{'view_growdesc'});
+ }
}
if ($raid->{'active'} && !$st[2]) {