Bug#484370: lvm2: please consider adding pvinfo to the Debian package

2008-06-04 Thread Bastian Blank
On Wed, Jun 04, 2008 at 12:01:25AM +0200, Carsten Hey wrote:
 please consider adding pvinfo, a small perl tool to display the physical
 allocation layout of lvm physical volumes to the Debian package lvm2.
 Maybe upstream is interested too.

Well, pvdisplay provides the same information. At least in current
versions.

 Example:
 $ /home/carsten/bin/pvinfo | head -n 10
  first/last PE#PE   device first/last 
 LE
 vg: vg_foghorn
   pv: /dev/hda3
 (  0 ..124 (  125 )) -- /dev/vg_foghorn/usr   (  0 ..
 124 )
 (125 ..249 (  125 )) -- /dev/vg_foghorn/var   (  0 ..
 124 )
 (250 ..499 (  250 )) -- /dev/vg_foghorn/vserver   (  0 ..
 249 )
 (500 ..624 (  125 )) -- /dev/vg_foghorn/srv   (  0 ..
 124 )
 (625 ..874 (  250 )) -- /dev/vg_foghorn/home  (  0 ..
 249 )
 (875 ..999 (  125 )) -- /dev/vg_foghorn/usr   (125 ..
 249 )
 (   1000 ..   1024 (   25 )) -- /dev/vg_foghorn/srv   (125 ..
 149 )

| # pvdisplay --maps
|   --- Physical volume ---
|   PV Name   /dev/sdb
|   VG Name   vg0_waldi
| [...]
|   --- Physical Segments ---
|   Physical extent 0 to 511:
| Logical volume  /dev/vg0_waldi/root
| Logical extents 0 to 511
|   Physical extent 512 to 1040:
| Logical volume  /dev/vg0_waldi/home
| Logical extents 3567 to 4095
|   Physical extent 1041 to 1041:
| FREE
|   Physical extent 1042 to 1045:
| Logical volume  /dev/vg0_waldi/kernel1_boot_yaboot
| Logical extents 0 to 3
|   Physical extent 1046 to 1301:
| Logical volume  /dev/vg0_waldi/kernel1_root
| Logical extents 0 to 255
| [...]

Bastian

-- 
If some day we are defeated, well, war has its fortunes, good and bad.
-- Commander Kor, Errand of Mercy, stardate 3201.7



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Bug#484370: lvm2: please consider adding pvinfo to the Debian package

2008-06-04 Thread Uli Martens
On Wed, Jun 04, 2008 at 10:06:18AM +0200, Bastian Blank wrote:
 On Wed, Jun 04, 2008 at 12:01:25AM +0200, Carsten Hey wrote:
  please consider adding pvinfo, a small perl tool to display the physical
  allocation layout of lvm physical volumes to the Debian package lvm2.
  Maybe upstream is interested too.
 
 Well, pvdisplay provides the same information. At least in current
 versions.

Yes, it does. Actually, pvinfo parses the output of pvdisplay and
lvdisplay. The reason I wrote pvinfo was to see this information at one
glance, as pvinfo's output is much more human readably and condensed
than that of pvdisplay / lvdisplay.

Please consider adding it at least as /usr/share/doc/lvm2/examples/pvinfo.

best regards,
 Uli / youam


signature.asc
Description: Digital signature


Bug#484370: lvm2: please consider adding pvinfo to the Debian package

2008-06-04 Thread Bastian Blank
On Wed, Jun 04, 2008 at 10:42:20AM +0200, Uli Martens wrote:
 pvinfo parses the output of pvdisplay and
 lvdisplay. The reason I wrote pvinfo was to see this information at one
 glance, as pvinfo's output is much more human readably and condensed
 than that of pvdisplay / lvdisplay.

And this is exactly the problem. It parses human readable output. IMHO
it should use vgcfgbackup to get a metadata dump and read that.

Bastian

-- 
Worlds are conquered, galaxies destroyed -- but a woman is always a woman.
-- Kirk, The Conscience of the King, stardate 2818.9



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Bug#484370: lvm2: please consider adding pvinfo to the Debian package

2008-06-03 Thread Carsten Hey
Package: lvm2
Severity: wishlist

Hi,

please consider adding pvinfo, a small perl tool to display the physical
allocation layout of lvm physical volumes to the Debian package lvm2.
Maybe upstream is interested too.

pvinfo is written by Uli Martens and released under the the GNU General
Public Version 2, its Homepage is http://youam.net/devel/pvinfo/

The manpage has not been added to the homepage, since it has just been
written by Uli and me, but it is attached to this mail, as is pvinfo
itself.

Example:

$ /home/carsten/bin/pvinfo | head -n 10
 first/last PE#PE   device first/last LE
vg: vg_foghorn
  pv: /dev/hda3
(  0 ..124 (  125 )) -- /dev/vg_foghorn/usr   (  0 ..
124 )
(125 ..249 (  125 )) -- /dev/vg_foghorn/var   (  0 ..
124 )
(250 ..499 (  250 )) -- /dev/vg_foghorn/vserver   (  0 ..
249 )
(500 ..624 (  125 )) -- /dev/vg_foghorn/srv   (  0 ..
124 )
(625 ..874 (  250 )) -- /dev/vg_foghorn/home  (  0 ..
249 )
(875 ..999 (  125 )) -- /dev/vg_foghorn/usr   (125 ..
249 )
(   1000 ..   1024 (   25 )) -- /dev/vg_foghorn/srv   (125 ..
149 )


Thanks,
Carsten
#!/usr/bin/perl

# show the distribution of LVs/LEs in the systems PVs
#
# Copyright 2005, 2008 Uli Martens [EMAIL PROTECTED]
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# version 2 as published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

# ChangeLog:
# 2008-01-20 Uli Martens [EMAIL PROTECTED]
#   * fix off-by-two error for lv slice sizes
# 2005-04-11 Uli Martens [EMAIL PROTECTED]
#   * written

# Example Output:
# $ ~/bin/pvinfo
# first/last PE#PE   devicefirst/last LE
# vg: vg
#  pv: /dev/md5
#(  0 ..295 (  296 )) -- /dev/vg/backup   (  0 ..295 )
#(296 ..807 (  512 )) -- /dev/vg/kyra (  0 ..511 )
# [...]


use strict;
use warnings;

#  vv config 

my $pvdisplay_file = pvdisplay |;
my $lvdisplay_file = lvdisplay -m |;

my $lvname_width = 25;
# ---

my $all;

my $pv;
my $lv;
my $vg;

open PVD, $pvdisplay_file
or die can't get pvdisplay info: $!;

while (PVD) {
if ( m/^  PV Name\s+(.*)$/ ) {
$pv = $1;
next;
}
if ( m/^  VG Name\s+(.*)$/ ) {
$vg = $1;
next;
}
if ( m/^  Total PE\s+(.*)$/ ) {
$all-{$vg}-{$pv}-{size} = $1 -1;
undef $vg;
undef $pv;
next;
}
#   print;
}
close PVD;

open LVD, $lvdisplay_file
or die can't get lvdisplay info: $!;

VG: while (LVD) {
if ( m/^  LV Name\s+(.*)$/ ) {
$lv = $1;
next;
}
if ( m/^  VG Name\s+(.*)$/ ) {
$vg = $1;
next;
}
if ( m/^  --- Segments ---$/ ) {
my $from;
my $to;
my $pfrom;
my $pto;
my $pv;
while (LVD) {
if ( m/^  --- Logical volume ---/ ) {
next VG;
}
if ( m/^  Logical extent (\d+) to (\d+):$/ ) {
$from = $1;
$to = $2;
next;
}
if ( m/^Physical volume\s+(.*)$/ ) {
$pv = $1;
next;
}
if ( m/^Physical extents\s+(\d+) to (\d+)$/ ) {
$pfrom = $1;
$pto = $2;
next;
}

if ( m/^\s*$/ and defined $pv ) {
#print GOT: $pv / $from / $to\n;
$all-{$vg}-{$pv}-{lvs}-{$pfrom} = {
from = $pfrom,
to = $pto,
lv = $lv,
pv = $pv,
pfrom = $from,
pto = $to,
};