All of lore.kernel.org
 help / color / mirror / Atom feed
* [linux-lvm] Resend: API for retrieving linux lvm information
@ 2004-09-07  6:04 Stanley Yue
  2004-09-07  9:44 ` Alasdair G Kergon
  0 siblings, 1 reply; 6+ messages in thread
From: Stanley Yue @ 2004-09-07  6:04 UTC (permalink / raw)
  To: linux-lvm

Hi:

I have ask about this before, however, i didn't any response.

I would appreciate very much if anyone can answer my question.

1) Is there any api library for retrieve linux lvm configuration? I.e.
querying for all the vg(s), pv(s), lv(s) on the system?

2) If yes, what license is the library release under?

Thanks,

Stanley

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [linux-lvm] Resend: API for retrieving linux lvm information
  2004-09-07  6:04 [linux-lvm] Resend: API for retrieving linux lvm information Stanley Yue
@ 2004-09-07  9:44 ` Alasdair G Kergon
  2004-09-08  1:39   ` Stanley Yue
  2005-07-13  9:03   ` Dieter Stüken
  0 siblings, 2 replies; 6+ messages in thread
From: Alasdair G Kergon @ 2004-09-07  9:44 UTC (permalink / raw)
  To: Stanley Yue, LVM general discussion and development

These answers are for LVM2.

On Mon, Sep 06, 2004 at 11:04:09PM -0700, Stanley Yue wrote:
> 1) Is there any api library for retrieve linux lvm configuration? I.e.
> querying for all the vg(s), pv(s), lv(s) on the system?
 
The commands: lvs, pvs, vgs with numerous cmdline flags.
See lib/report/columns.h for field names

Access to cmds via library interface: configure --enable-cmdlib

include lvm2cmd.h

Example usage: doc/example_cmdlib.c

Recommend only manipulating one thing at once, so if it
returns an error you don't have to work out which thing
went wrong.

[May yet add an optional argc/argv-style entry point.]

> 2) If yes, what license is the library release under?
The library API is intended to be LGPL.
It's effectively a wrapper around the command-line interface,
but more efficient because it's able to cache some internal 
state between commands.
[I shall correct the copyright notices: the library entry-point 
got moved which messed up the original GPL/LGPL code split.]

liblvm.a does *not* provide a supported API and will sometimes 
change in subtle or incompatible ways without warning.  Don't be 
tempted to link against it.  The only interface supported
is the one based on the command-line.

Alasdair
-- 
agk@redhat.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [linux-lvm] Resend: API for retrieving linux lvm information
  2004-09-07  9:44 ` Alasdair G Kergon
@ 2004-09-08  1:39   ` Stanley Yue
  2004-09-08  9:35     ` Alasdair G Kergon
  2005-07-13  9:03   ` Dieter Stüken
  1 sibling, 1 reply; 6+ messages in thread
From: Stanley Yue @ 2004-09-08  1:39 UTC (permalink / raw)
  To: Stanley Yue, LVM general discussion and development

Alasdair:

Thanks for your response.

Given your last comment, I think i'm going to just perform the parsing
from cmd-line or through /proc/lvm instead if using the apis.

As far as the parsing goes, is it better (in terms of compatibility,
output stability) to parse against the command line output (i.e.
lvdisplay) or against the /proc/filesystems (i.e.
/proc/lvm/VGs/vg00/LVs)?

Also, it is unclear to me what is the meaning of each fields/values by
looking at the information stored in the /proc/* by itself.

[root@DAP-RHLNX1 LVs]# cat /proc/lvm/VGs/vg00/LVs/vol1 
name:         /dev/vg00/vol1
size:         409600
access:       3
status:       1
number:       0
open:         0
allocation:   0
device:       58:00

For example, what does it mean by "access: 3"?

Is all the information available from query apis (i.e. pvdisplay,
lvdisplay) also available from the /proc/lvm subdirectories?
How can we find out the meaning of each fields/value from the
/proc/lvm information?

Thanks,

Stanley


On Tue, 7 Sep 2004 10:44:13 +0100, Alasdair G Kergon <agk@redhat.com> wrote:
> These answers are for LVM2.
> 
> On Mon, Sep 06, 2004 at 11:04:09PM -0700, Stanley Yue wrote:
> > 1) Is there any api library for retrieve linux lvm configuration? I.e.
> > querying for all the vg(s), pv(s), lv(s) on the system?
>  
> The commands: lvs, pvs, vgs with numerous cmdline flags.
> See lib/report/columns.h for field names
> 
> Access to cmds via library interface: configure --enable-cmdlib
> 
> include lvm2cmd.h
> 
> Example usage: doc/example_cmdlib.c
> 
> Recommend only manipulating one thing at once, so if it
> returns an error you don't have to work out which thing
> went wrong.
> 
> [May yet add an optional argc/argv-style entry point.]
> 
> > 2) If yes, what license is the library release under?
> The library API is intended to be LGPL.
> It's effectively a wrapper around the command-line interface,
> but more efficient because it's able to cache some internal
> state between commands.
> [I shall correct the copyright notices: the library entry-point
> got moved which messed up the original GPL/LGPL code split.]
> 
> liblvm.a does *not* provide a supported API and will sometimes
> change in subtle or incompatible ways without warning.  Don't be
> tempted to link against it.  The only interface supported
> is the one based on the command-line.
> 
> Alasdair
> --
> agk@redhat.com
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [linux-lvm] Resend: API for retrieving linux lvm information
  2004-09-08  1:39   ` Stanley Yue
@ 2004-09-08  9:35     ` Alasdair G Kergon
  2004-09-08 23:51       ` Stanley Yue
  0 siblings, 1 reply; 6+ messages in thread
From: Alasdair G Kergon @ 2004-09-08  9:35 UTC (permalink / raw)
  To: Stanley Yue, LVM general discussion and development

On Tue, Sep 07, 2004 at 06:39:24PM -0700, Stanley Yue wrote:
> As far as the parsing goes, is it better (in terms of compatibility,
> output stability) to parse against the command line output (i.e.
> lvdisplay) or against the /proc/filesystems (i.e.
> /proc/lvm/VGs/vg00/LVs)?
 
My answer was for LVM2.
Looks like you're using LVM1.
To simplify your future upgrade you should consider using LVM2 tools
lvs/pvs/vgs read-only even on an LVM1 installation as their output is 
designed to be easy to parse.

Alasdair
-- 
agk@redhat.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [linux-lvm] Resend: API for retrieving linux lvm information
  2004-09-08  9:35     ` Alasdair G Kergon
@ 2004-09-08 23:51       ` Stanley Yue
  0 siblings, 0 replies; 6+ messages in thread
From: Stanley Yue @ 2004-09-08 23:51 UTC (permalink / raw)
  To: Stanley Yue, LVM general discussion and development

Thanks, Alasdair.

I'll indeed look into using LVM2.

I'm using Redhat AS 3.0. 

Will the lvm2 rpm from Fedora Core work?
When will lvm2 be officially part of Redhat Enterprise Linux?
How can i upgrade from an LVM1 system to LVM2? Is it just a matter of
upgrading the rpm?

Thanks,

Stanley


On Wed, 8 Sep 2004 10:35:18 +0100, Alasdair G Kergon <agk@redhat.com> wrote:
> On Tue, Sep 07, 2004 at 06:39:24PM -0700, Stanley Yue wrote:
> > As far as the parsing goes, is it better (in terms of compatibility,
> > output stability) to parse against the command line output (i.e.
> > lvdisplay) or against the /proc/filesystems (i.e.
> > /proc/lvm/VGs/vg00/LVs)?
>  
> My answer was for LVM2.
> Looks like you're using LVM1.
> To simplify your future upgrade you should consider using LVM2 tools
> lvs/pvs/vgs read-only even on an LVM1 installation as their output is
> designed to be easy to parse.
> 
> Alasdair
> --
> agk@redhat.com
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [linux-lvm] Resend: API for retrieving linux lvm information
  2004-09-07  9:44 ` Alasdair G Kergon
  2004-09-08  1:39   ` Stanley Yue
@ 2005-07-13  9:03   ` Dieter Stüken
  1 sibling, 0 replies; 6+ messages in thread
From: Dieter Stüken @ 2005-07-13  9:03 UTC (permalink / raw)
  To: LVM general discussion and development

Alasdair G Kergon wrote:
> These answers are for LVM2.
> 
> On Mon, Sep 06, 2004 at 11:04:09PM -0700, Stanley Yue wrote:
> 
>>1) Is there any api library for retrieve linux lvm configuration? I.e.
>>querying for all the vg(s), pv(s), lv(s) on the system?
> 
> The commands: lvs, pvs, vgs with numerous cmdline flags.
> See lib/report/columns.h for field names

liblvm.a seems handy, to generate lvm command line tools, but I'm missing
a clear differentiation between modifying and non modifying usage.

I'm asking, as I want to develop some lvm information system running
as a web service to provide a quick overview about my lvm configuration
and status. Thus I definitely want to run it as non root. I might use
those nice lvs,pvs,vgs commands, but I don't want to provide them with
a suid-bit, as they are potentially able to modify my lvm. The former
/proc interface was ideal for this purpose, but it seems to be missing for
LVM2. Are there any plans, to provide lvm informations via /proc or /sys
again, or would it be possible to write somehow "restricted" lvm-tools
using liblvm?

Dieter.
-- 
Dieter St�ken, con terra GmbH, M�nster
     stueken@conterra.de
     http://www.conterra.de/
     (0)251-7474-501

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2005-07-13  9:03 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-09-07  6:04 [linux-lvm] Resend: API for retrieving linux lvm information Stanley Yue
2004-09-07  9:44 ` Alasdair G Kergon
2004-09-08  1:39   ` Stanley Yue
2004-09-08  9:35     ` Alasdair G Kergon
2004-09-08 23:51       ` Stanley Yue
2005-07-13  9:03   ` Dieter Stüken

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.