]> sourceware.org Git - lvm2.git/commitdiff
report: use brackets to signify LVs which are not visible when reporting lv_parent
authorPeter Rajnoha <prajnoha@redhat.com>
Mon, 11 Jan 2016 14:34:35 +0000 (15:34 +0100)
committerPeter Rajnoha <prajnoha@redhat.com>
Mon, 11 Jan 2016 14:34:35 +0000 (15:34 +0100)
Use common _lvname_disp to report lv_parent. The _lvname_disp
takes care of properly marking LVs which are not visible - such
LVs are always enclosed in brackets when reported within any
other field.

For example, thin pool over RAID.

Before:

$ lvs -a -o name,lv_parent,data_lv,metadata_lv vg
  LV                          Parent           Data               Meta
  cache_pool                                   [cache_pool_tdata] [cache_pool_tmeta]
  [cache_pool_tdata]          cache_pool
  [cache_pool_tdata_rimage_0] cache_pool_tdata
  [cache_pool_tdata_rimage_1] cache_pool_tdata
  [cache_pool_tdata_rmeta_0]  cache_pool_tdata
  [cache_pool_tdata_rmeta_1]  cache_pool_tdata
  [cache_pool_tmeta]          cache_pool
  [cache_pool_tmeta_rimage_0] cache_pool_tmeta
  [cache_pool_tmeta_rimage_1] cache_pool_tmeta
  [cache_pool_tmeta_rmeta_0]  cache_pool_tmeta
  [cache_pool_tmeta_rmeta_1]  cache_pool_tmeta
  [lvol0_pmspare]

With this patch applied:

$ lvs -a -o name,lv_parent,data_lv,metadata_lv vg
  LV                          Parent             Data               Meta
  cache_pool                                     [cache_pool_tdata] [cache_pool_tmeta]
  [cache_pool_tdata]          cache_pool
  [cache_pool_tdata_rimage_0] [cache_pool_tdata]
  [cache_pool_tdata_rimage_1] [cache_pool_tdata]
  [cache_pool_tdata_rmeta_0]  [cache_pool_tdata]
  [cache_pool_tdata_rmeta_1]  [cache_pool_tdata]
  [cache_pool_tmeta]          cache_pool
  [cache_pool_tmeta_rimage_0] [cache_pool_tmeta]
  [cache_pool_tmeta_rimage_1] [cache_pool_tmeta]
  [cache_pool_tmeta_rmeta_0]  [cache_pool_tmeta]
  [cache_pool_tmeta_rmeta_1]  [cache_pool_tmeta]
  [lvol0_pmspare]

WHATS_NEW
lib/report/report.c

index d622c9fbabc1047569a7435499aeccdc26798a77..f316054fd778d906c1955d9bcaa6405541e53168 100644 (file)
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
 Version 2.02.140 -
 ===================================
+  Use brackets to signify LVs which are not visible when reporting lv_parent.
   Fix invalid memory read when reporting cache LV policy_name (2.02.126).
 
 Version 2.02.139 - 8th January 2016
index bb2736fc5a496e375d7b7240b7d776d36a6ff5a5..17aa5c0bdfe085f77911afde01cb616ca59a112a 100644 (file)
@@ -1655,15 +1655,15 @@ static int _lvfullname_disp(struct dm_report *rh, struct dm_pool *mem,
 
 static int _lvparent_disp(struct dm_report *rh, struct dm_pool *mem,
                          struct dm_report_field *field,
-                         const void *data, void *private __attribute__((unused)))
+                         const void *data, void *private)
 {
        const struct logical_volume *lv = (const struct logical_volume *) data;
-       char *repstr;
+       struct logical_volume *parent_lv = lv_parent(lv);
 
-       if (!(repstr = lv_parent_dup(mem, lv)))
-               return_0;
+       if (!parent_lv)
+               return _field_set_value(field, "", NULL);
 
-       return _field_set_value(field, repstr, NULL);
+       return _lvname_disp(rh, mem, field, parent_lv, private);
 }
 
 static int _do_datalv_disp(struct dm_report *rh, struct dm_pool *mem __attribute__((unused)),
This page took 0.043543 seconds and 5 git commands to generate.