On Tue Dec 22 11:27:43 2009,
https://launchpad.net/~alvind wrote:
Show quoted text> When using snapshots, lvdisplay -v also outputs information about
> snapshots, like:
> LV snapshot status
> COW-table size
> COW-table LE
> Allocated to snapshot
>
> These values can not yet be read with Linux::LVM
This patch fixes that:
--- /root/.cpan/build/Linux-LVM-0.14-g6S72j/LVM.pm 2008-07-02
02:53:41.000000000 -0500
+++ bin/lib/Linux/LVM.pm 2009-12-21 15:53:50.000000000 -0600
@@ -325,6 +331,16 @@ sub get_vg_information() {
$vghash{$vgn}->{lvols}->{$lvn}->{read_ahead} = $1;
next VGINF; }
+
+ elsif( m/Allocated to snapshot\s+(\S+)%/ ) {
+ $vghash{$vgn}->{lvols}->{$lvn}->{'allocated_to_snapshot'} = $1;
+ next VGINF; }
+
+ elsif( m/COW-table size\s+([0-9\.]+)\s+(\S+)/ ) {
+ $vghash{$vgn}->{lvols}->{$lvn}->{'cow_table_size'} = $1;
+ $vghash{$vgn}->{lvols}->{$lvn}->{'cow_table_unit'} = $2;
+ next VGINF; }
+
# Parse the physical disk name.
elsif( m/PV Name\s+(\S+)/ ) {
$pvn = $1;
@@ -515,6 +545,15 @@ sub get_lv_info($) {
if( m/Block device\s+(\S+)/ ) {
$lvhash{block_device} = $1;
next LVINF; }
+
+ if( m/Allocated to snapshot\s+(\S+)%/ ) {
+ $lvhash{allocated_to_snapshot} = $1;
+ next LVINF; }
+
+ elsif( m/COW-table size\s+([0-9\.]+)\s+(\S+)/ ) {
+ $lvhash{'cow_table_size'} = $1;
+ $lvhash{'cow_table_unit'} = $2;
+ next LVINF; }
}
return %lvhash;
} # End of the get_lv_info routine.