1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-03-10 16:58:47 +03:00

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
This commit is contained in:
Peter Rajnoha 2016-03-01 15:25:04 +01:00
parent 0339a5f447
commit 8f47119f6f

View File

@ -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))