Show snapshot usage

This commit is contained in:
Jamie Cameron
2008-04-24 17:08:27 +00:00
parent 9f3b4f5ade
commit c878fab44d
4 changed files with 23 additions and 1 deletions

View File

@@ -10,3 +10,5 @@ Fixed display of space used on each physical volume by a logical volume for LVM
Re-designed the module's main page to use tabs, and added an option to show volumes and groups in tables (with more information) instead of using icons.
Converted all user interface code to use the new Webmin UI library.
Fixed the command used to move data to another physical volume under LVM 2.
---- Changes since 1.410 ----
The percentage of a snapshot's blocks used is now shown on the Edit Snapshot page.

View File

@@ -78,6 +78,12 @@ if ($lv->{'is_snap'}) {
[ map { $_->{'name'} } grep { !$_->{'is_snap'} } @lvs ]);
}
print &ui_table_row($text{'lv_snapof'}, $snapsel);
# Show snapshot percentage used
if ($lv->{'snapusage'}) {
print &ui_table_row($text{'lv_snapusage'},
$lv->{'snapusage'}."%");
}
}
elsif ($stat[2]) {
# Display current permissons and allocation method
@@ -121,7 +127,7 @@ if (@stat && $stat[2]) {
&nice_size($free*1024));
print &ui_table_row($text{'lv_free'},
($total ? 100 * $free / $total : 0)." %");
int($total ? 100 * $free / $total : 0)." %");
}
# Show extents on PVs

View File

@@ -88,6 +88,7 @@ lv_mountmsg=Mount this LV on new directory on your system, so that it can be use
lv_free=Free percentage
lv_freedisk=Free space
lv_pvs=Physical volumes allocated
lv_snapusage=Snapshot use percentage
mkfs_title=Create Filesystem
mkfs_desc=This form allows you to build a new $2 ($1) filesystem on logical volume $3. All existing data will be erased.

View File

@@ -259,6 +259,16 @@ if (-d $lvm_proc) {
$lv->{'is_snap'} = $p{'access'} == 5;
$lv->{'stripes'} = $p{'stripes'};
push(@rv, $lv);
# For snapshots, use the lvdisplay command to get usage
if ($lv->{'is_snap'}) {
local $out = &backquote_command(
"lvdisplay ".quotemeta($lv->{'device'}).
" 2>/dev/null");
if ($out =~/Allocated\s+to\s+snapshot\s+([0-9\.]+)%/i) {
$lv->{'snapusage'} = $1;
}
}
}
closedir(DIR);
}
@@ -298,6 +308,9 @@ else {
elsif (/Stripes\s+(\d+)/) {
$lv->{'stripes'} = $1;
}
elsif (/Allocated\s+to\s+snapshot\s+([0-9\.]+)%/i) {
$lv->{'snapusage'} = $1;
}
}
close(DISPLAY);
@rv = grep { $_->{'vg'} eq $_[0] } @rv;