Show raid rebuild speed and time left
authorJamie Cameron <jcameron@webmin.com>
Sun, 23 May 2010 19:21:22 +0000 (12:21 -0700)
committerJamie Cameron <jcameron@webmin.com>
Sun, 23 May 2010 19:21:22 +0000 (12:21 -0700)
raid/CHANGELOG
raid/raid-lib.pl
raid/view_raid.cgi

index eea7777..1f47a26 100644 (file)
@@ -32,3 +32,4 @@ Added a button to remove a detached partition, thanks to Caspar Smit.
 Added support for creating EXT4 filesystems.
 ---- Changes since 1.510 ----
 Conversion from RAID 5 to 6 and vice versa is now possible, thanks to Caspar Smit.
+When a RAID array is being rebuilt, show the speed and time remaining, thanks to Farid Benamrouche.
index b8ab1eb..ae8df84 100755 (executable)
@@ -168,6 +168,16 @@ else {
                                }
                        }
                close(MDSTAT);
+               open(MDSTAT, $config{'mdstat'});
+               while(<MDSTAT>){
+                       if (/^.*finish=(\S+)min/){
+                               $md->{'remain'} = $1;
+                               }
+                       if (/^.*speed=(\S+)K/){
+                               $md->{'speed'} = $1;
+                               }
+                       }
+               close(MDSTAT);
                push(@get_raidtab_cache, $md);
                }
 
index afd9493..7795a91 100755 (executable)
@@ -81,7 +81,9 @@ if ($raid->{'state'}) {
 
 # Rebuild percent
 if ($raid->{'rebuild'}) {
-       print &ui_table_row($text{'view_rebuild'}, $raid->{'rebuild'}." \%");
+       print &ui_table_row($text{'view_rebuild'},
+               $raid->{'rebuild'}." \% (".$raid->{'remain'}." min, ".
+               $raid->{'speed'}." KBytes/s)");
        }