Bug 1334667 - Add new lvm2 command to do complete report per VG
Summary: Add new lvm2 command to do complete report per VG
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: LVM and device-mapper
Classification: Community
Component: lvm2
Version: unspecified
Hardware: All
OS: Linux
medium
low
Target Milestone: ---
: ---
Assignee: Peter Rajnoha
QA Contact: cluster-qe@redhat.com
URL:
Whiteboard:
Depends On: 1334655
Blocks: 1334682 1346079
TreeView+ depends on / blocked
 
Reported: 2016-05-10 09:37 UTC by Peter Rajnoha
Modified: 2017-08-24 08:39 UTC (History)
6 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2017-08-24 08:39:53 UTC
Embargoed:
prajnoha: lvm-technical-solution+
rule-engine: lvm-test-coverage?


Attachments (Terms of Use)

Description Peter Rajnoha 2016-05-10 09:37:15 UTC
Add new lvm2 command (e.g. "lvm fullreport") that does complete and full report for each VG. Such complete report includes these types which are going to be subreports of the whole report group (see also bug #1334655 which adds support for report groups):

  - "pv" (for PV-related fields for PVs which are in the VG),
  - "vg" (for VG-related fields),
  - "lv" (for LV-related fields for LVs which are in the VG),
  - "segs" (for LV segments for each LV in the VG),
  - "pvsegs" (for PV segments for each PV in the VG).

All these subreports are reported per VG, that also means per one VG lock.

For PVs which are not yet in in a VG, only "pv" subreport is going to be reported.

By default, each type will output all that is possible for that subreport, that means pv_all, vg_all, lv_all, segs_all and pvsegs_all fields which automatically expands to complete set of fields and including extra fields necessary to make a relation among subreports:

  - "lv_uuid" field for "segs" subreport,
  - "pv_uuid" and "lv_uuid" field for "pvsegs" subreport.
  - ("pv"/"vg"/"lv" subreports already has fields which makes it easy to identify where the entity belongs)

User should be able to change fields to display in "lvm fullreport" by new lvm.conf settings, similarly to existing <subreport_type>_cols setting, as well as fields defined directly on command line using "-o|--options". When using "-o|--options" on command line, it should be possible to select which subreport we're defining options for, for example "-o <subreport_type>,field1,field2,..." So the first item in the list of options defines the subreport for which the list that follows belongs to.

Also, the new "lvm fullreport" command should be able to switch among different report formats, JSON for starters, just like any other reporting command (see also bug #1334659).

Comment 1 Peter Rajnoha 2016-05-11 13:59:03 UTC
Example (I've used only limited number of fields so it's still readable here):


# pvs -o pv_name
  PV        
  /dev/sda  
  /dev/vda2 

# vgs -o vg_name
  VG    
  fedora
  vg    

# lvs -o lv_name
  LV   
  root 
  swap 
  lvol0

# lvs --segments -o lv_name,seg_size
  LV    SSize  
  root   19.00g
  swap  500.00m
  lvol0   4.00m

# pvs --segments -o pv_name,pvseg_size
  PV         SSize
  /dev/sda       1
  /dev/sda      30
  /dev/vda2   4864
  /dev/vda2    125


# lvm fullreport --reportformat json -o pv,pv_name -o vg,vg_name -o lv,lv_name -o seg,lv_name,seg_size -o pvseg,pv_name,pvseg_size
  {
      "report": [
          {
              "vg": [
                  {"vg_name":"vg"}
              ]
              ,
              "pv": [
                  {"pv_name":"/dev/sda"}
              ]
              ,
              "lv": [
                  {"lv_name":"lvol0"}
              ]
              ,
              "pvseg": [
                  {"pv_name":"/dev/sda", "pvseg_size":1},
                  {"pv_name":"/dev/sda", "pvseg_size":30}
              ]
              ,
              "seg": [
                  {"lv_name":"lvol0", "seg_size":"4.00m"}
              ]
          }
          ,
          {
              "vg": [
                  {"vg_name":"fedora"}
              ]
              ,
              "pv": [
                  {"pv_name":"/dev/vda2"}
              ]
              ,
              "lv": [
                  {"lv_name":"root"},
                  {"lv_name":"swap"}
              ]
              ,
              "pvseg": [
                  {"pv_name":"/dev/vda2", "pvseg_size":4864},
                  {"pv_name":"/dev/vda2", "pvseg_size":125}
              ]
              ,
              "seg": [
                  {"lv_name":"root", "seg_size":"19.00g"},
                  {"lv_name":"swap", "seg_size":"500.00m"}
              ]
          }
      ]
  }

Comment 2 Peter Rajnoha 2016-09-22 11:22:11 UTC
There's a new "lvm fullreport" command to do complete report per VG which contains 5 subreports (vg, pv, lv, pvseg and seg). This feature is available since lvm2 2.02.158.

For more information, see "man 8 lvm fullreport" and "man 7 lvmreport".


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