Bug 614049 - Add lvm2app APIs to query all pvs/vgs/lvs report fields and set values as with {pv|vg|lv}change
Summary: Add lvm2app APIs to query all pvs/vgs/lvs report fields and set values as wit...
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: lvm2   
(Show other bugs)
Version: 6.1
Hardware: All
OS: Linux
Target Milestone: rc
: ---
Assignee: Petr Rockai
QA Contact: Corey Marthaler
Depends On:
TreeView+ depends on / blocked
Reported: 2010-07-13 15:13 UTC by Dave Wysochanski
Modified: 2011-05-19 14:26 UTC (History)
8 users (show)

Fixed In Version: lvm2-2.02.82-1.el6
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2011-05-19 14:26:18 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
Design notes for generic attributes and why I decided this approach. (1.72 KB, text/plain)
2010-10-07 15:16 UTC, Dave Wysochanski
no flags Details

External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2011:0772 normal SHIPPED_LIVE lvm2 bug fix and enhancement update 2011-05-18 18:08:31 UTC

Description Dave Wysochanski 2010-07-13 15:13:55 UTC
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):

How reproducible:

Steps to Reproduce:
Actual results:

Expected results:

Additional info:

Comment 1 Dave Wysochanski 2010-10-06 17:32:07 UTC
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

Comment 2 Dave Wysochanski 2010-10-07 15:16:17 UTC
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.

Comment 3 Dave Wysochanski 2010-10-12 14:27:49 UTC
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

Comment 4 Dave Wysochanski 2010-10-21 16:35:34 UTC
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.

Comment 5 Petr Rockai 2010-11-17 21:15:46 UTC
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.

Comment 8 errata-xmlrpc 2011-05-19 14:26:18 UTC
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.


Note You need to log in before you can comment on or make changes to this bug.