Description of problem:
lvm2app currently only exports a few of the most common attributes for PVs, VGs, and LVs and a more comprehensive / generic interface is needed on the order of pvs/vgs/lvs reporting commands. A few patch sets were submitted last year and should be continued to completion.
Ideally this interface should be a simple 'get' / 'set' paradigm, with attribute naming similar to the reporting commands. Auto-generation of symbols may be used similar to lib/report/columns.h.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
Fairly large patchset checked in upstream which refactors and extends existing reporting infrastructure. We now have the framework for this 'get' / 'set' paradigm, and all 'get' functions for PV and VG are checked in too. Patches that extend lvm2app (lvm_vg_get_property(), etc) have not been checked in yet, but these are small, have been submitted on the list, and testing is on going. They will be checked in as a group once the remaining items below are finished.
Still todo and in progress:
1) finish 'lv' attributes.
2) add helpers to lookup a pv/lv handle from a vg handle and/or pv/lv name. Callers can do this now but it is a manual process (must call lvm_vg_list_pvs() or lvm_vg_list_lvs() and then loop through the list comparing.
3) add lvm2app support for 'lvseg' and 'pvseg'
4) finish 'lvseg' and 'pvseg' attributes
5) add unit tests / nightly tests
Created attachment 452120 [details]
Design notes for generic attributes and why I decided this approach.
These were my design notes, and why I decided on this approach to the generic attributes, instead of the earlier approaches / patches posted which extended the reporting infrastructure.
Additional cleanup patch sets proposed as a result of code review:
1) add dm_pool_asprintf(). See https://www.redhat.com/archives/lvm-devel/2010-October/msg00059.html
2) cleanup log_error() paths for attribute patches and lvm2app code. Make memory allocation failures similar return (some places we are using log_errno(ENOMEM, ...), others return_NULL, etc
Still some final bits to be worked out in exported function prototypes. Patches are basically ready to go though, with 2 different function prototypes proposed. Only thing that remains is the two "percent" / float lv fields, and the lvseg/pvseg fields. I've submitted preliminary patches for most of the lvseg properties, and pvseg fields should be trivial once lvseg properties are finalized. So this is 95% complete at this point.
I have merged Dave's patches. I'll create a separate bugzilla for percent fields (I do have a plan) and also for other setters (ideally, when we get some feedback on what is actually needed). I will also make a bugzilla for automated testing coverage of the API. This one can go POST.
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.