diff options
author | Peter Rajnoha <prajnoha@redhat.com> | 2016-03-01 15:25:04 +0100 |
---|---|---|
committer | Peter Rajnoha <prajnoha@redhat.com> | 2016-03-03 13:49:15 +0100 |
commit | 8f47119f6fb00b685d3a631ca9464ab940ee256a (patch) | |
tree | 7177d92fc9c38b658782cc977ec93d3082d1fcbe | |
parent | 0339a5f447f8d0b12bb874f19e84427849b33674 (diff) | |
download | lvm2-8f47119f6fb00b685d3a631ca9464ab940ee256a.tar.gz |
report: add new 'none' lv_layout and 'history' lv_role and mark historical LVs that way
Report proper values for historical LVs in lv_layout and lv_role fields.
Any historical LV doesn't have any layout anymore and the role is "history".
For example:
$ lvs -H -o name,lv_attr,lv_layout,lv_role vg/-lvol1
LV Attr Layout Role
-lvol1 ----h----- none public,history
-rw-r--r-- | lib/metadata/lv_manip.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c index ed46ad353..e355cc4a9 100644 --- a/lib/metadata/lv_manip.c +++ b/lib/metadata/lv_manip.c @@ -84,8 +84,10 @@ struct lv_names { enum { LV_TYPE_UNKNOWN, + LV_TYPE_NONE, LV_TYPE_PUBLIC, LV_TYPE_PRIVATE, + LV_TYPE_HISTORY, LV_TYPE_LINEAR, LV_TYPE_STRIPED, LV_TYPE_MIRROR, @@ -130,8 +132,10 @@ enum { static const char *_lv_type_names[] = { [LV_TYPE_UNKNOWN] = "unknown", + [LV_TYPE_NONE] = "none", [LV_TYPE_PUBLIC] = "public", [LV_TYPE_PRIVATE] = "private", + [LV_TYPE_HISTORY] = "history", [LV_TYPE_LINEAR] = "linear", [LV_TYPE_STRIPED] = "striped", [LV_TYPE_MIRROR] = "mirror", @@ -472,6 +476,12 @@ int lv_layout_and_role(struct dm_pool *mem, const struct logical_volume *lv, goto bad; } + if (lv_is_historical(lv)) { + if (!str_list_add_no_dup_check(mem, *layout, _lv_type_names[LV_TYPE_NONE]) || + !str_list_add_no_dup_check(mem, *role, _lv_type_names[LV_TYPE_HISTORY])) + goto_bad; + } + /* Mirrors and related */ if ((lv_is_mirror_type(lv) || lv_is_pvmove(lv)) && !_lv_layout_and_role_mirror(mem, lv, *layout, *role, &public_lv)) |