1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00
lvm2/lib/metadata
Peter Rajnoha e8bbcda2a3 Add lv_layout_and_type fn, lv_layout and lv_type reporting fields.
The lv_layout and lv_type fields together help with LV identification.
We can do basic identification using the lv_attr field which provides
 very condensed view. In contrast to that, the new lv_layout and lv_type
fields provide more detialed information on exact layout and type used
for LVs.

For top-level LVs which are pure types not combined with any
other LV types, the lv_layout value is equal to lv_type value.

For non-top-level LVs which may be combined with other types,
the lv_layout describes the underlying layout used, while the
lv_type describes the use/type/usage of the LV.

These two new fields are both string lists so selection (-S/--select)
criteria can be defined using the list operators easily:
  [] for strict matching
  {} for subset matching.

For example, let's consider this:

$ lvs -a -o name,vg_name,lv_attr,layout,type
  LV                    VG     Attr       Layout       Type
  [lvol1_pmspare]       vg     ewi------- linear       metadata,pool,spare
  pool                  vg     twi-a-tz-- pool,thin    pool,thin
  [pool_tdata]          vg     rwi-aor--- level10,raid data,pool,thin
  [pool_tdata_rimage_0] vg     iwi-aor--- linear       image,raid
  [pool_tdata_rimage_1] vg     iwi-aor--- linear       image,raid
  [pool_tdata_rimage_2] vg     iwi-aor--- linear       image,raid
  [pool_tdata_rimage_3] vg     iwi-aor--- linear       image,raid
  [pool_tdata_rmeta_0]  vg     ewi-aor--- linear       metadata,raid
  [pool_tdata_rmeta_1]  vg     ewi-aor--- linear       metadata,raid
  [pool_tdata_rmeta_2]  vg     ewi-aor--- linear       metadata,raid
  [pool_tdata_rmeta_3]  vg     ewi-aor--- linear       metadata,raid
  [pool_tmeta]          vg     ewi-aor--- level1,raid  metadata,pool,thin
  [pool_tmeta_rimage_0] vg     iwi-aor--- linear       image,raid
  [pool_tmeta_rimage_1] vg     iwi-aor--- linear       image,raid
  [pool_tmeta_rmeta_0]  vg     ewi-aor--- linear       metadata,raid
  [pool_tmeta_rmeta_1]  vg     ewi-aor--- linear       metadata,raid
  thin_snap1            vg     Vwi---tz-k thin         snapshot,thin
  thin_snap2            vg     Vwi---tz-k thin         snapshot,thin
  thin_vol1             vg     Vwi-a-tz-- thin         thin
  thin_vol2             vg     Vwi-a-tz-- thin         multiple,origin,thin

Which is a situation with thin pool, thin volumes and thin snapshots.
We can see internal 'pool_tdata' volume that makes up thin pool has
actually a level10 raid layout and the internal 'pool_tmeta' has
level1 raid layout. Also, we can see that 'thin_snap1' and 'thin_snap2'
are both thin snapshots while 'thin_vol1' is thin origin (having
multiple snapshots).

Such reporting scheme provides much better base for selection criteria
in addition to providing more detailed information, for example:

$ lvs -a -o name,vg_name,lv_attr,layout,type -S 'type=metadata'
LV                   VG   Attr       Layout      Type
[lvol1_pmspare]      vg   ewi------- linear      metadata,pool,spare
[pool_tdata_rmeta_0] vg   ewi-aor--- linear      metadata,raid
[pool_tdata_rmeta_1] vg   ewi-aor--- linear      metadata,raid
[pool_tdata_rmeta_2] vg   ewi-aor--- linear      metadata,raid
[pool_tdata_rmeta_3] vg   ewi-aor--- linear      metadata,raid
[pool_tmeta]         vg   ewi-aor--- level1,raid metadata,pool,thin
[pool_tmeta_rmeta_0] vg   ewi-aor--- linear      metadata,raid
[pool_tmeta_rmeta_1] vg   ewi-aor--- linear      metadata,raid

(selected all LVs which are related to metadata of any type)

lvs -a -o name,vg_name,lv_attr,layout,type -S 'type={metadata,thin}'
LV           VG   Attr       Layout      Type
[pool_tmeta] vg   ewi-aor--- level1,raid metadata,pool,thin

(selected all LVs which hold metadata related to thin)

lvs -a -o name,vg_name,lv_attr,layout,type -S 'type={thin,snapshot}'
LV         VG   Attr       Layout     Type
thin_snap1 vg   Vwi---tz-k thin       snapshot,thin
thin_snap2 vg   Vwi---tz-k thin       snapshot,thin

(selected all LVs which are thin snapshots)

lvs -a -o name,vg_name,lv_attr,layout,type -S 'layout=raid'
LV           VG   Attr       Layout       Type
[pool_tdata] vg   rwi-aor--- level10,raid data,pool,thin
[pool_tmeta] vg   ewi-aor--- level1,raid  metadata,pool,thin

(selected all LVs with raid layout, any raid layout)

lvs -a -o name,vg_name,lv_attr,layout,type -S 'layout={raid,level1}'
  LV           VG   Attr       Layout      Type
  [pool_tmeta] vg   ewi-aor--- level1,raid metadata,pool,thin

(selected all LVs with raid level1 layout exactly)

And so on...
2014-08-15 14:50:38 +02:00
..
cache_manip.c cache+thin: add lv_is_{cache,thin}_origin fn to identify origin LVs 2014-08-15 13:28:43 +02:00
lv_alloc.h raid/misc: Allow creation of parallel areas by LV vs segment 2014-06-25 21:20:41 -05:00
lv_manip.c Add lv_layout_and_type fn, lv_layout and lv_type reporting fields. 2014-08-15 14:50:38 +02:00
lv.c report: lvs: properly display 'o' for volume type bit and 'C' for target type bit in lv_attr field for cache origin LVs 2014-08-15 13:28:43 +02:00
lv.h refactor: remove static modifier for lv_raid_image_in_sync and lv_raid_healthy fn 2014-07-04 15:40:17 +02:00
merge.c pvvmove: add a few comments 2014-06-20 11:41:20 +01:00
metadata-exported.h Add lv_layout_and_type fn, lv_layout and lv_type reporting fields. 2014-08-15 14:50:38 +02:00
metadata.c pvcreate: Fix cache state with filters/sig wiping. 2014-08-14 01:30:01 +01:00
metadata.h report: Add lv_parent field. 2014-07-03 23:49:34 +01:00
mirror.c raid/misc: Allow creation of parallel areas by LV vs segment 2014-06-25 21:20:41 -05:00
pool_manip.c thin and cache: unify pool common code 2014-07-22 22:41:38 +02:00
pv_alloc.h cleanup: self compilable headers 2013-12-12 13:28:19 +01:00
pv_manip.c misc: after releasing a PV segment, merge it with any adjacent free space 2014-06-25 22:04:58 -05:00
pv_map.c logging: classify log_debug messages 2013-01-07 22:30:29 +00:00
pv_map.h Track unreserved space for all alloc policies and then permit NORMAL to place 2012-02-01 02:10:45 +00:00
pv.c pv_vg_name: do not expose internal orphans to lvm2 users 2014-03-19 00:57:59 +01:00
pv.h cleanup: self compilable headers 2013-12-12 13:28:19 +01:00
raid_manip.c raid: Moved degraded activation code to raid_manip. 2014-07-22 20:50:29 +01:00
replicator_manip.c logging: classify log_debug messages 2013-01-07 22:30:29 +00:00
segtype.c clean: remove unneeded assign 2013-06-17 09:34:56 +02:00
segtype.h refactor: add defines for raid segtypes 2014-08-15 13:28:43 +02:00
snapshot_manip.c snapshot: check snapshot exists 2014-06-17 13:36:07 +02:00
thin_manip.c Add lv_layout_and_type fn, lv_layout and lv_type reporting fields. 2014-08-15 14:50:38 +02:00
vg.c lvmetad: more reuse precommit buffer 2014-03-01 14:08:58 +01:00
vg.h lvmetad: more reuse precommit buffer 2014-03-01 14:08:58 +01:00