Bug 1112551 - Provide criteria-based LVM reporting
Summary: Provide criteria-based LVM reporting
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: lvm2
Version: 6.6
Hardware: All
OS: Linux
low
low
Target Milestone: rc
: ---
Assignee: Peter Rajnoha
QA Contact: Cluster QE
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-06-24 08:00 UTC by Peter Rajnoha
Modified: 2014-10-14 08:25 UTC (History)
16 users (show)

Fixed In Version: lvm2-2.02.107-1.el6
Doc Type: Enhancement
Doc Text:
Feature: Criteria-based LVM reporting. Reason: When there are numerous VGs/LVs to manage, it may be impractical to handle them as the output from LVM reporting tools may be long enough for the user to read it quickly and efficiently. Also, when using output from LVM reporting tools in scripts, it's usually required to process only the lines we're interested in - most of the time this was accomplished by use of external tools to select proper lines (e.g. grep) from the outpout which was then processed further. This approach caused various problems, including dependencies on external tools and also most of the time there was a need to change the script itself if LVM changed the output or formatting in some way. This posed extra effort to handle LVM output efficiently and correctly. Criteria-based reporting provides a built-in selection of lines to be reported by LVM reporting command. Result: LVM reporting commands (pvs/vgs/lvs/pvdisplay/vgdisplay/lvdisplay/lvm devtypes) now understand new -S/--select SelectionCriteria option where SelectionCriteria are criteria constructed by using reporting field names, restricting field values we're interested in by using comparison operators and creating more complex criteria by using grouping and logical operators.
Clone Of: 867376
Environment:
Last Closed: 2014-10-14 08:25:16 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2014:1387 0 normal SHIPPED_LIVE lvm2 bug fix and enhancement update 2014-10-14 01:39:47 UTC

Description Peter Rajnoha 2014-06-24 08:00:33 UTC
This feature got into 6.6 with lvm2 v2.02.107. I'm cloning this feature bug for 6.6 and QA to test this/comment on this.

+++ This bug was initially created as a clone of Bug #867376 +++
--- Additional comment from Peter Rajnoha on 2014-06-24 09:15:14 CEST ---

The final released version looks like this (lvm2 v2.02.107/libdevmapper v1.02.86):

pvs/vgs/lvs/pvdisplay/vgdisplay/lvdisplay/lvm devtypes -S SELECTION

# pvs -S help

  Selection operands
  ------------------
    field               - Reporting field.
    number              - Non-negative integer value.
    size                - Floating point value with units, 'm' unit used by default if not specified.
    percent             - Non-negative integer with or without % suffix.
    string              - Characters quoted by ' or " or unquoted.
    string list         - Strings enclosed by [ ] and elements delimited by either
                          "all items must match" or "at least one item must match" operator.
    regular expression  - Characters quoted by ' or " or unquoted.
   
  Reserved values
  ---------------
    -1, undefined, undef, unknown   - Reserved value for undefined numeric value. [number]
    unmanaged                       - Reserved value for unmanaged number of metadata copies in VG. [number]
    auto                            - Reserved value for size that is automatically calculated. [size]
   
  Selection operators
  -------------------
    Comparison operators:
        =~  - Matching regular expression. [regex]
        !~  - Not matching regular expression. [regex]
         =  - Equal to. [number, size, percent, string, string list]
        !=  - Not equal to. [number, size, percent, string, string_list]
        >=  - Greater than or equal to. [number, size, percent]
         >  - Greater than. [number, size, percent]
        <=  - Less than or equal to. [number, size, percent]
         <  - Less than. [number, size, percent]
   
    Logical and grouping operators:
        &&  - All fields must match
         ,  - All fields must match
        ||  - At least one field must match
         #  - At least one field must match
         !  - Logical negation
         (  - Left parenthesis
         )  - Right parenthesis
         [  - List start
         ]  - List end


(the reserved values are specific to the tool, e.g. dmsetup doesn't define any of these reserved values)

From man lvm (8):

Informal grammar specification:

              STATEMENT = column cmp_op VALUE | STATEMENT log_op STATEMENT | (STATEMENT) | !(STATEMENT)

              VALUE = [VALUE log_op VALUE]
              For list-based types: string list. The log_op must always be of one type within the whole list value.

              VALUE = value
              For scalar types: number (integer), size (floating point number with size unit suffix), percent (floating point number with or without % suffix), string.

Comment 1 Peter Rajnoha 2014-06-24 08:02:48 UTC
There's quite extensive test in LVM test suite already: https://git.fedorahosted.org/cgit/lvm2.git/tree/test/shell/report-select.sh

Comment 3 Corey Marthaler 2014-08-06 23:36:17 UTC
Marking verified (Sanity Only), I went through a few of these and verified that they work. We'll try and integrate this into our tests for even more regression coverage in the future.


2.6.32-495.el6.x86_64
lvm2-2.02.109-1.el6    BUILT: Tue Aug  5 10:36:23 CDT 2014
lvm2-libs-2.02.109-1.el6    BUILT: Tue Aug  5 10:36:23 CDT 2014
lvm2-cluster-2.02.109-1.el6    BUILT: Tue Aug  5 10:36:23 CDT 2014
udev-147-2.57.el6    BUILT: Thu Jul 24 08:48:47 CDT 2014
device-mapper-1.02.88-1.el6    BUILT: Tue Aug  5 10:36:23 CDT 2014
device-mapper-libs-1.02.88-1.el6    BUILT: Tue Aug  5 10:36:23 CDT 2014
device-mapper-event-1.02.88-1.el6    BUILT: Tue Aug  5 10:36:23 CDT 2014
device-mapper-event-libs-1.02.88-1.el6    BUILT: Tue Aug  5 10:36:23 CDT 2014
device-mapper-persistent-data-0.3.2-1.el6    BUILT: Fri Apr  4 08:43:06 CDT 2014
cmirror-2.02.109-1.el6    BUILT: Tue Aug  5 10:36:23 CDT 2014

Comment 4 errata-xmlrpc 2014-10-14 08:25:16 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2014-1387.html


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