master - report: add lv_origin_uuid field
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=199697accff0658a11420e263c1f85fb74cd39d3 Commit: 199697accff0658a11420e263c1f85fb74cd39d3 Parent: cb8f29d1473d993d890387fe24331c9b9fe4713c Author: Peter Rajnoha <[email protected]> AuthorDate: Mon Sep 21 12:44:29 2015 +0200 Committer: Peter Rajnoha <[email protected]> CommitterDate: Mon Sep 21 14:20:36 2015 +0200
report: add lv_origin_uuid field
--- lib/metadata/lv.c | 36 ++++++++++++++++++++++++++---------- lib/metadata/lv.h | 2 ++ lib/report/columns.h | 1 + lib/report/properties.c | 2 ++ lib/report/report.c | 42 ++++++++++++++++++++++++++++++------------ 5 files changed, 61 insertions(+), 22 deletions(-)
lib/metadata/lv.c +26 -10
@@ -219,21 +219,37 @@ uint32_t lv_kernel_read_ahead(const struct logical_volume *lv)return info.read_ahead; } -char *lv_origin_dup (struct dm_pool *mem,const struct logical_volume *lv) +static char *_do_lv_origin_dup (struct dm_pool *mem,const struct logical_volume *lv, +int uuid) { -if (lv_is_cow (lv)) -return lv_name_dup (mem,origin_from_cow (lv)); +struct logical_volume *origin; -if (lv_is_cache (lv) &&first_seg (lv)->origin) -return lv_name_dup (mem,first_seg (lv)->origin); -if (lv_is_thin_volume (lv) &&first_seg (lv)->origin) -return lv_name_dup (mem,first_seg (lv)->origin); +if (lv_is_cow (lv)) + origin =origin_from_cow (lv); +else if (lv_is_cache (lv) &&first_seg (lv)->origin) + origin =first_seg (lv)->origin; +else if (lv_is_thin_volume (lv) &&first_seg (lv)->origin) + origin =first_seg (lv)->origin; +else if (lv_is_thin_volume (lv) &&first_seg (lv)->external_lv) + origin =first_seg (lv)->external_lv; +else +return NULL ; -if (lv_is_thin_volume (lv) &&first_seg (lv)->external_lv) -return lv_name_dup (mem,first_seg (lv)->external_lv); +if (uuid) +return lv_uuid_dup (mem, origin); +else +return lv_name_dup (mem, origin); +} -return NULL ; +char *lv_origin_dup (struct dm_pool *mem,const struct logical_volume *lv) +{ +return _do_lv_origin_dup (mem, lv,0 ); +} + +char *lv_origin_uuid_dup (struct dm_pool *mem,const struct logical_volume *lv) +{ +return _do_lv_origin_dup (mem, lv,1 ); }char *lv_name_dup (struct dm_pool *mem,const struct logical_volume *lv)
lib/metadata/lv.h +2 -0
@@ -83,6 +83,8 @@ char *lv_fullname_dup(struct dm_pool *mem, const struct logical_volume *lv);struct logical_volume *lv_parent (const struct logical_volume *lv);char *lv_parent_dup (struct dm_pool *mem,const struct logical_volume *lv);char *lv_origin_dup (struct dm_pool *mem,const struct logical_volume *lv); +char *lv_origin_uuid_dup (struct dm_pool *mem,const struct logical_volume *lv); +uint32_t lv_kernel_read_ahead (const struct logical_volume *lv);const char *lvseg_name (const struct lv_segment *seg);uint64_t lvseg_start (const struct lv_segment *seg);
lib/report/columns.h +1 -0
@@ -63,6 +63,7 @@ FIELD(LVS, lv, SIZ, "LSize", size, 5, size64, lv_size, "Size of LV in current un FIELD(LVS, lv, SIZ, "MSize", lvid, 6, lvmetadatasize, lv_metadata_size, "For thin and cache pools, the size of the LV that holds the metadata.", 0) FIELD(LVS, lv, NUM, "#Seg", lvid, 4, lvsegcount, seg_count, "Number of segments in LV.", 0) FIELD(LVS, lv, STR, "Origin", lvid, 6, origin, origin, "For snapshots, the origin device of this LV.", 0) +FIELD(LVS, lv, STR, "Origin UUID", lvid, 38, originuuid, origin_uuid, "For snapshots, the UUID of origin device of this LV.", 0) FIELD(LVS, lv, SIZ, "OSize", lvid, 5, originsize, origin_size, "For snapshots, the size of the origin device of this LV.", 0) FIELD(LVS, lv, STR_LIST, "Ancestors", lvid, 12, lvancestors, lv_ancestors, "Ancestors of this LV.", 0)FIELD (LVS , lv,STR_LIST ,"Descendants" , lvid,12 , lvdescendants, lv_descendants,"Descendants of this LV." ,0 )
lib/report/properties.c +2 -0
@@ -298,6 +298,8 @@ GET_LV_NUM_PROPERTY_FN(seg_count, dm_list_size(&lv->segments))#define _seg_count_set prop_not_implemented_set GET_LV_STR_PROPERTY_FN(origin, lv_origin_dup(lv->vg->vgmem, lv))#define _origin_set prop_not_implemented_set +GET_LV_STR_PROPERTY_FN(origin_uuid, lv_origin_uuid_dup(lv->vg->vgmem, lv)) +#define _origin_uuid_set prop_not_implemented_set GET_LV_NUM_PROPERTY_FN(origin_size, (SECTOR_SIZE * lv_origin_size(lv)))#define _origin_size_set prop_not_implemented_set#define _lv_ancestors_set prop_not_implemented_set
lib/report/report.c +30 -12
56 lines not on this page · raw message