diff options
author | Peter Rajnoha <prajnoha@redhat.com> | 2016-03-01 15:25:04 +0100 |
---|---|---|
committer | Peter Rajnoha <prajnoha@redhat.com> | 2016-03-03 12:56:55 +0100 |
commit | 6277aca24130076dbc286cd9dda12747a1776114 (patch) | |
tree | 6a08ed67f5916a7832a87564815cd1f623f2c059 | |
parent | 62b2d3b81c7f40f4e243a3aaa767698afaff2c86 (diff) | |
download | lvm2-6277aca24130076dbc286cd9dda12747a1776114.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)) |