Skip Menu |

This queue is for tickets about the Linux-LVM CPAN distribution.

Report information
The Basics
Id: 94991
Status: open
Priority: 0/
Queue: Linux-LVM

People
Owner: Nobody in particular
Requestors: dieterich [...] mpipz.mpg.de
Cc: CARNIL [...] cpan.org
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Bugfix for Linux-LVM-0.17
Date: Thu, 24 Apr 2014 11:30:08 +0200
To: bug-Linux-LVM [...] rt.cpan.org
From: Roland Dieterich <dieterich [...] mpipz.mpg.de>
While setting up a new Debain box with FAI, I stumbled over an issue with setting up LVM. FAIs setup-storage failed, complaining about uninitialized variables somewhere in the LVM.pm module. It turned out, that someone else also stumbled upon this and filed a bug report with FAI: https://www.mail-archive.com/linux-fai@uni-koeln.de/msg05423.html Thomas Lange guessed right, the issue is in the Linux::LVM perl module, version 0.17. I managed to fix the issue, see the attached patch file. After applying the patch, FAI setup-storage works fine again with LVM. Best regards, Roland -- Roland Dieterich IT-Manager Max Planck-Genome-centre Cologne Building B Carl-von-Linné-Weg 10 50829 Köln Tel: (+49)221-5062816 Fax: (+49)221-5062851

Message body is not shown because sender requested not to inline it.

From: blacky+perl [...] fluffbunny.de
I'm also experiencing this bug. Noticing the distinctive lack of testcases in this module I have patched get_vg_information() to be able to accept testdata suitable for parsing. use Linux::LVM; $Linux::LVM::testmode = 1; my %config = get_vg_information(@testdata); 10_get_vg_information.t contains 2 testcases - one with empty data and one with output from vgdisplay -v (lvm2 v2.02 on linux 3.14) which triggers the described bug.
Subject: 10_get_vg_information.t
use strict; use warnings; # TODO enumerate and test number of iterations properly use Test::More qw(no_plan); use Linux::LVM; $Linux::LVM::testmode = 1; { my @testdata = (); my %computed = get_vg_information(@testdata); my %expected = (); is_deeply(\%computed, \%expected, 'empty output'); } { my @testdata = ( 'File descriptor 7 (pipe:[150486]) leaked on vgdisplay invocation. Parent PID 15370: bash', ' Finding all volume groups', ' Finding volume group "vg_storage"', ' --- Volume group ---', ' VG Name vg_storage', ' System ID ', ' Format lvm2', ' Metadata Areas 1', ' Metadata Sequence No 8', ' VG Access read/write', ' VG Status resizable', ' MAX LV 0', ' Cur LV 5', ' Open LV 4', ' Max PV 0', ' Cur PV 1', ' Act PV 1', ' VG Size 3.64 TiB', ' PE Size 4.00 MiB', ' Total PE 953596', ' Alloc PE / Size 671744 / 2.56 TiB', ' Free PE / Size 281852 / 1.08 TiB', ' VG UUID Ouq085-ElYJ-Ez1I-5Ln7-cmby-eDwB-31qffY', ' ', ' --- Logical volume ---', ' LV Path /dev/vg_storage/video', ' LV Name video', ' VG Name vg_storage', ' LV UUID fRfXdG-yCrN-aBcm-pvF1-De6h-eVpQ-nFeCwa', ' LV Write Access read/write', ' LV Creation host, time workbench, 2014-01-28 16:43:10 +0100', ' LV Status available', ' # open 1', ' LV Size 1.00 TiB', ' Current LE 262144', ' Segments 1', ' Allocation inherit', ' Read ahead sectors auto', ' - currently set to 256', ' Block device 254:8', ' ', ); my %computed = get_vg_information(@testdata); my %expected = ( 'vg_storage' => { 'pe_size' => '4.00', 'open_lv' => '4', 'alloc_pe' => '671744', 'total_pe' => '953596', 'cur_pv' => '1', 'access' => 'read/write', 'max_pv' => '0', 'free_pe' => '281852', 'vgname' => 'vg_storage', 'max_lv' => '0', 'alloc_pe_size' => '2.56', 'act_pv' => '1', 'free_pe_size_unit' => 'TiB', 'free_pe_size' => '1.08', 'status' => 'resizable', 'cur_lv' => '5', 'lvols' => { 'video' => { 'cur_le' => '262144', 'read_ahead' => 'auto', 'open_lv' => '1', 'segments' => '1', 'status' => 'available', 'name' => 'video', 'lv_size' => '1.00', 'device' => '254:8', 'allocation' => 'inherit', 'lv_size_unit' => 'TiB', 'write_access' => 'read/write', 'uuid' => 'fRfXdG-yCrN-aBcm-pvF1-De6h-eVpQ-nFeCwa' }, '/dev/vg_storage/video' => { 'name' => '/dev/vg_storage/video' }, }, 'pe_size_unit' => 'MiB', 'uuid' => 'Ouq085-ElYJ-Ez1I-5Ln7-cmby-eDwB-31qffY', 'vg_size' => '3.64', 'vg_size_unit' => 'TiB', 'alloc_pe_size_unit' => 'TiB' }, ); is_deeply(\%computed, \%expected, '[LVM 2.02] one vg with a single volume'); }
Subject: unittest-enable-patch_LVM.pm
--- vanilla/LVM.pm 2013-11-07 02:22:55.000000000 +0100 +++ patched/LVM.pm 2014-05-17 00:22:16.468199268 +0200 @@ -38,6 +38,7 @@ our $VERSION = '0.17'; our $units; +our $testmode = 0; # Preloaded methods go here. @@ -167,7 +168,9 @@ #-----------------------------------------------------------------------# # Return Values: On success, a hash with all of the vg information. # #-----------------------------------------------------------------------# -sub get_vg_information() { +sub get_vg_information { + my @testinput = @_; + my %vghash; my $vgn; my $lvn; @@ -177,7 +180,11 @@ my $units_arg = ''; $units_arg = " --units $units " if ($units); - if ( -e "/usr/sbin/vgdisplay" ) { + if ($testmode) { + print "I: Using provided input for testing.\n"; + @vginfo = @testinput; + } + elsif ( -e "/usr/sbin/vgdisplay" ) { @vginfo = `/usr/sbin/vgdisplay -v $units_arg`; } else { if( ! -e "/sbin/vgdisplay" ) { die("LVM utilities not installed in /sbin or /usr/sbin"); }