[linux-lvm] Resend: API for retrieving linux lvm information
Alasdair G Kergon
agk at redhat.com
Tue Sep 7 09:44:13 UTC 2004
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 at redhat.com
More information about the linux-lvm
mailing list