[linux-lvm] api recommandation (example_cmdlib.c doesnt work properly)?

Zdenek Kabelac zkabelac at redhat.com
Wed May 9 08:27:55 UTC 2018


Dne 9.5.2018 v 08:52 Oliver Rath napsal(a):
> Hi list,
> 
> i tried to get some lvm-commands working using example_cmdlib.c
> (modified, attached). Unfortunatly the example hangs trying a "lvcreate
> --name test --size 12M levg" command:

Hi

Please avoid tweaking code to use  cmdlib - it's  internal library and
lvm2 is highly recommending to always FORK  lvm2 command - instead
of trying to embeded it in your application.

There are numerous memory requirements during certain operation that would be 
pretty bad to be imposed for other users tool.

If you want to 'stream' multiple commands - you could pipe  lvm shell to 
minimize forking, however than error reporting & reaction becomes a bit harder 
to play with.

> 
> Whats wrong here? Ist there a better api for communicating from other
> programs?

It's simply not official API and it's based on internal knowledge and uses 
settings from lvm.conf - these settings are tied to use of lvm command.

> 
> Imho the python support is deprecated, lvm2app is deprecated, dbus-api
> is limited at the moment (right? Didnt find documentation for it), so
> the only way seems liblvm or call explicit the lvm-tools.


dBus API is somewhat 'frozen' as there is no active development on this part,
and would be nice to get someone involved into this more...


Regards


Zdenek




More information about the linux-lvm mailing list