[lvm-devel] [PATCH 08/13] Add lvm_vg_get_attr_value() libLVM API to query to value of a VG attribute.

Dave Wysochanski dwysocha at redhat.com
Fri Feb 13 11:30:10 UTC 2009


On Tue, 2009-02-03 at 00:47 +0100, Petr Rockai wrote:
> Dave Wysochanski <dwysocha at redhat.com> writes:
> > This API may be used independently to query the value of a VG attribute,
> > provided the name of the attribute is known.  If the name of the attribute(s)
> > are unknown, the previous API, vg_get_attr_list(), may be used.
> I suppose this makes the field names part of the API. Nothing wrong with that,
> they are already exported into the command-level interface, just wanted to make
> that fact explicit.
> 

Yes.  The field names will be the same as in the reporting commands of
the tools so in theory, these should be well-known names and should not
change.

Note that this implementation of lvm_vg_get_attr_value() and
lvm_vg_get_attr_list() is deprecated by my latest attempt at attributes
based on the dm_report_output_attributes() function.  My second attempt
was meant to address the following 2 shortcomings:
1. The report handle must be kept alive as long as the attributes are
used.  To accomplish this, I allocate the report handle inside vg_open()
and deallocate inside vg_close()
2. There was no good way to match up a field name with a value other
than repeatedly calling lvm_vg_get_attr_value().  To solve this I
decided a better approach was to define a attribute structure, which
contained the name and the value.  This will also allow me to add an
access mode for the attribute (read-only or read/write).






More information about the lvm-devel mailing list