summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Rajnoha <prajnoha@redhat.com>2015-03-17 09:49:08 +0100
committerPeter Rajnoha <prajnoha@redhat.com>2016-02-15 12:44:46 +0100
commitf75e42c06cd925d414c1069d6c51e0b50e1934a8 (patch)
tree6df1add2312290dfda99ae983cb8e23f7d7079cb
parente0b141510523bb09e5a784d6e1b30f106e8dbbf3 (diff)
downloadlvm2-f75e42c06cd925d414c1069d6c51e0b50e1934a8.tar.gz
report: add pv_ext_vsn field to display PV header extension version used
For example: $ pvs -o pv_name,vg_name,pv_ext_vsn,pv_in_use PV VG ExtVsn InUse /dev/sda 2 /dev/sdb vg 2 used /dev/vda2 fedora 1 used
-rw-r--r--lib/report/columns.h1
-rw-r--r--lib/report/properties.c2
-rw-r--r--lib/report/report.c17
3 files changed, 20 insertions, 0 deletions
diff --git a/lib/report/columns.h b/lib/report/columns.h
index e6f848556..7ea7f5252 100644
--- a/lib/report/columns.h
+++ b/lib/report/columns.h
@@ -122,6 +122,7 @@ FIELD(LABEL, label, SIZ, "DevSize", dev, 7, devsize, dev_size, "Size of underlyi
FIELD(LABEL, label, STR, "PV", dev, 10, dev_name, pv_name, "Name.", 0)
FIELD(LABEL, label, SIZ, "PMdaFree", type, 9, pvmdafree, pv_mda_free, "Free metadata area space on this device in current units.", 0)
FIELD(LABEL, label, SIZ, "PMdaSize", type, 9, pvmdasize, pv_mda_size, "Size of smallest metadata area on this device in current units.", 0)
+FIELD(LABEL, label, NUM, "PExtVsn", type, 7, pvextvsn, pv_ext_vsn, "PV header extension version.", 0)
FIELD(PVS, pv, NUM, "1st PE", pe_start, 7, size64, pe_start, "Offset to the start of data on the underlying device.", 0)
FIELD(PVS, pv, SIZ, "PSize", id, 5, pvsize, pv_size, "Size of PV in current units.", 0)
diff --git a/lib/report/properties.c b/lib/report/properties.c
index 118e659d0..d23e4c9bb 100644
--- a/lib/report/properties.c
+++ b/lib/report/properties.c
@@ -190,6 +190,8 @@ GET_PV_NUM_PROPERTY_FN(pv_ba_size, SECTOR_SIZE * pv->ba_size)
#define _pv_exported_get prop_not_implemented_get
#define _pv_missing_set prop_not_implemented_set
#define _pv_missing_get prop_not_implemented_get
+#define _pv_ext_vsn_get prop_not_implemented_get
+#define _pv_ext_vsn_set prop_not_implemented_set
#define _pv_in_use_get prop_not_implemented_get
#define _pv_in_use_set prop_not_implemented_set
diff --git a/lib/report/report.c b/lib/report/report.c
index f7f3775dc..3f2bd0cd2 100644
--- a/lib/report/report.c
+++ b/lib/report/report.c
@@ -2554,6 +2554,23 @@ static int _pvmdasize_disp(struct dm_report *rh, struct dm_pool *mem,
return _size64_disp(rh, mem, field, &min_mda_size, private);
}
+static int _pvextvsn_disp(struct dm_report *rh, struct dm_pool *mem,
+ struct dm_report_field *field,
+ const void *data, void *private)
+{
+ const struct label *label = (const struct label *) data;
+ struct lvmcache_info *info = label->info;
+ uint32_t ext_version;
+
+ if (info) {
+ ext_version = lvmcache_ext_version(info);
+ return _uint32_disp(rh, mem, field, &ext_version, private);
+ }
+
+ return _field_set_value(field, "", &GET_TYPE_RESERVED_VALUE(num_undef_64));
+}
+
+
static int _vgmdasize_disp(struct dm_report *rh, struct dm_pool *mem,
struct dm_report_field *field,
const void *data, void *private)