Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
May
April
March
February
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
List overview
Download
lvm2-commits
March 2016
----- 2025 -----
May 2025
April 2025
March 2025
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
lvm2-commits@lists.fedorahosted.org
8 participants
168 discussions
Start a n
N
ew thread
master - metadata: honour 'nohistory' switch when removing thin LVs
by Peter Rajnoha
03 Mar '16
03 Mar '16
Gitweb:
http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=f545dd5952ee0b19…
Commit: f545dd5952ee0b191ae2cda2d7b6f304442debab Parent: 9a34de9cb9c1e8585f11bbb79bc447fdbdf7ea31 Author: Peter Rajnoha <prajnoha(a)redhat.com> AuthorDate: Tue Mar 1 15:25:28 2016 +0100 Committer: Peter Rajnoha <prajnoha(a)redhat.com> CommitterDate: Thu Mar 3 13:49:15 2016 +0100 metadata: honour 'nohistory' switch when removing thin LVs When --nohistory switch is used with lvremove, the LV that is removed is not recorded in metadata as 'historical LV'. --- lib/metadata/pool_manip.c | 15 +++++++++++---- 1 files changed, 11 insertions(+), 4 deletions(-) diff --git a/lib/metadata/pool_manip.c b/lib/metadata/pool_manip.c index ac590b3..d2856ae 100644 --- a/lib/metadata/pool_manip.c +++ b/lib/metadata/pool_manip.c @@ -215,10 +215,17 @@ static int _set_up_historical_lv(struct lv_segment *seg_to_remove, { struct generic_logical_volume *glv = NULL; - if (seg_to_remove->origin || seg_to_remove->indirect_origin || - dm_list_size(&seg_to_remove->lv->segs_using_this_lv) || - dm_list_size(&seg_to_remove->lv->indirect_glvs)) { - if (!(glv = _create_historical_glv(seg_to_remove))) + if (seg_to_remove->lv->vg->cmd->record_historical_lvs) { + if (seg_to_remove->origin || seg_to_remove->indirect_origin || + dm_list_size(&seg_to_remove->lv->segs_using_this_lv) || + dm_list_size(&seg_to_remove->lv->indirect_glvs)) { + if (!(glv = _create_historical_glv(seg_to_remove))) + return_0; + } + } else { + if (seg_to_remove->indirect_origin && + !remove_glv_from_indirect_glvs(seg_to_remove->indirect_origin, + seg_to_remove->lv->this_glv)) return_0; }
1
0
0
0
master - cmd: add 'nohistory' option and wire it up in cmd_context
by Peter Rajnoha
03 Mar '16
03 Mar '16
Gitweb:
http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=9a34de9cb9c1e858…
Commit: 9a34de9cb9c1e8585f11bbb79bc447fdbdf7ea31 Parent: 8f47119f6fb00b685d3a631ca9464ab940ee256a Author: Peter Rajnoha <prajnoha(a)redhat.com> AuthorDate: Tue Mar 1 15:25:14 2016 +0100 Committer: Peter Rajnoha <prajnoha(a)redhat.com> CommitterDate: Thu Mar 3 13:49:15 2016 +0100 cmd: add 'nohistory' option and wire it up in cmd_context The --nohistory switch will cause historical LVs to not be recorded in metadata on demand. --- lib/commands/toolcontext.h | 1 + tools/args.h | 1 + tools/lvmcmdline.c | 2 ++ 3 files changed, 4 insertions(+), 0 deletions(-) diff --git a/lib/commands/toolcontext.h b/lib/commands/toolcontext.h index b5328e8..6a6267d 100644 --- a/lib/commands/toolcontext.h +++ b/lib/commands/toolcontext.h @@ -129,6 +129,7 @@ struct cmd_context { unsigned independent_metadata_areas:1; /* active formats have MDAs outside PVs */ unsigned unknown_system_id:1; unsigned include_historical_lvs:1; /* also process/report/display historical LVs */ + unsigned record_historical_lvs:1; /* record historical LVs */ unsigned include_foreign_vgs:1; /* report/display cmds can reveal foreign VGs */ unsigned include_shared_vgs:1; /* report/display cmds can reveal lockd VGs */ unsigned include_active_foreign_vgs:1; /* cmd should process foreign VGs with active LVs */ diff --git a/tools/args.h b/tools/args.h index 8dfe744..dc7b9e1 100644 --- a/tools/args.h +++ b/tools/args.h @@ -69,6 +69,7 @@ arg(mknodes_ARG, '\0', "mknodes", NULL, 0) arg(monitor_ARG, '\0', "monitor", yes_no_arg, 0) arg(nameprefixes_ARG, '\0', "nameprefixes", NULL, 0) arg(noheadings_ARG, '\0', "noheadings", NULL, 0) +arg(nohistory_ARG, '\0', "nohistory", NULL, 0) arg(nolocking_ARG, '\0', "nolocking", NULL, 0) arg(norestorefile_ARG, '\0', "norestorefile", NULL, 0) arg(nosuffix_ARG, '\0', "nosuffix", NULL, 0) diff --git a/tools/lvmcmdline.c b/tools/lvmcmdline.c index 4a5cd23..ffe8447 100644 --- a/tools/lvmcmdline.c +++ b/tools/lvmcmdline.c @@ -1102,6 +1102,8 @@ static int _get_settings(struct cmd_context *cmd) cmd->include_foreign_vgs = arg_is_set(cmd, foreign_ARG) ? 1 : 0; cmd->include_shared_vgs = arg_is_set(cmd, shared_ARG) ? 1 : 0; cmd->include_historical_lvs = arg_is_set(cmd, history_ARG) ? 1 : 0; + cmd->include_historical_lvs = arg_is_set(cmd, history_ARG) ? 1 : 0; + cmd->record_historical_lvs = arg_is_set(cmd, nohistory_ARG) ? 0 : 1; /* * This is set to zero by process_each which wants to print errors
1
0
0
0
master - report: add new 'none' lv_layout and 'history' lv_role and mark historical LVs that way
by Peter Rajnoha
03 Mar '16
03 Mar '16
Gitweb:
http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=8f47119f6fb00b68…
Commit: 8f47119f6fb00b685d3a631ca9464ab940ee256a Parent: 0339a5f447f8d0b12bb874f19e84427849b33674 Author: Peter Rajnoha <prajnoha(a)redhat.com> AuthorDate: Tue Mar 1 15:25:04 2016 +0100 Committer: Peter Rajnoha <prajnoha(a)redhat.com> CommitterDate: Thu Mar 3 13:49:15 2016 +0100 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 --- 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 ed46ad3..e355cc4 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))
1
0
0
0
master - report: add full_descendants field to display descendants with history
by Peter Rajnoha
03 Mar '16
03 Mar '16
Gitweb:
http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=0339a5f447f8d0b1…
Commit: 0339a5f447f8d0b12bb874f19e84427849b33674 Parent: 715f1fb4c4cbdb49a86ee95e17070d0ecc548ee0 Author: Peter Rajnoha <prajnoha(a)redhat.com> AuthorDate: Tue Mar 1 15:24:48 2016 +0100 Committer: Peter Rajnoha <prajnoha(a)redhat.com> CommitterDate: Thu Mar 3 13:49:15 2016 +0100 report: add full_descendants field to display descendants with history Same as lv_full_ancestors, but the other way round in the ancestry chain. --- lib/report/columns.h | 3 +- lib/report/properties.c | 2 + lib/report/report.c | 100 ++++++++++++++++++++++++++++++++++++++++------- 3 files changed, 89 insertions(+), 16 deletions(-) diff --git a/lib/report/columns.h b/lib/report/columns.h index 07ebc44..f22b37a 100644 --- a/lib/report/columns.h +++ b/lib/report/columns.h @@ -67,7 +67,8 @@ FIELD(LVS, lv, STR, "Origin UUID", lvid, 38, originuuid, origin_uuid, "For snaps 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, "LV ancestors ignoring any stored history of the ancestry chain.", 0) FIELD(LVS, lv, STR_LIST, "FAncestors", lvid, 12, lvfullancestors, lv_full_ancestors, "LV ancestors including stored history of the ancestry chain.", 0) -FIELD(LVS, lv, STR_LIST, "Descendants", lvid, 12, lvdescendants, lv_descendants, "Descendants of this LV.", 0) +FIELD(LVS, lv, STR_LIST, "Descendants", lvid, 12, lvdescendants, lv_descendants, "LV descendants ignoring any stored history of the ancestry chain.", 0) +FIELD(LVS, lv, STR_LIST, "FDescendants", lvid, 12, lvfulldescendants, lv_full_descendants, "LV descendants including stored history of the ancestry chain.", 0) FIELD(LVS, lv, PCT, "Data%", lvid, 6, datapercent, data_percent, "For snapshot and thin pools and volumes, the percentage full if LV is active.", 0) FIELD(LVS, lv, PCT, "Snap%", lvid, 6, snpercent, snap_percent, "For snapshots, the percentage full if LV is active.", 0) FIELD(LVS, lv, PCT, "Meta%", lvid, 6, metadatapercent, metadata_percent, "For thin pools, the percentage of metadata full if LV is active.", 0) diff --git a/lib/report/properties.c b/lib/report/properties.c index c879bc8..92e30c9 100644 --- a/lib/report/properties.c +++ b/lib/report/properties.c @@ -316,6 +316,8 @@ GET_LV_NUM_PROPERTY_FN(origin_size, (SECTOR_SIZE * lv_origin_size(lv))) #define _lv_full_ancestors_get prop_not_implemented_get #define _lv_descendants_set prop_not_implemented_set #define _lv_descendants_get prop_not_implemented_get +#define _lv_full_descendants_set prop_not_implemented_set +#define _lv_full_descendants_get prop_not_implemented_get GET_LV_NUM_PROPERTY_FN(snap_percent, _snap_percent(lv)) #define _snap_percent_set prop_not_implemented_set GET_LV_NUM_PROPERTY_FN(copy_percent, _copy_percent(lv)) diff --git a/lib/report/report.c b/lib/report/report.c index b1ba9fd..1a4ce42 100644 --- a/lib/report/report.c +++ b/lib/report/report.c @@ -2034,33 +2034,70 @@ static int _lvfullancestors_disp(struct dm_report *rh, struct dm_pool *mem, } static int _find_descendants(struct _str_list_append_baton *descendants, - struct logical_volume *lv) + struct generic_logical_volume glv, + int full, int include_historical_lvs) { - struct logical_volume *descendant_lv = NULL; + struct generic_logical_volume glv_next = {0}; const struct seg_list *sl; struct lv_segment *seg; + struct glv_list *glvl; + struct dm_list *list; + const char *descendant_str; + char buf[64]; - if (lv_is_origin(lv)) { - dm_list_iterate_items_gen(seg, &lv->snapshot_segs, origin_list) { - if ((descendant_lv = seg->cow)) { - if (!_str_list_append(descendant_lv->name, descendants)) + if (glv.is_historical) { + if (full) { + list = &glv.historical->indirect_glvs; + dm_list_iterate_items(glvl, list) { + if (!glvl->glv->is_historical || include_historical_lvs) { + if (!(descendant_str = _get_glv_str(buf, sizeof(buf), glvl->glv))) + return_0; + if (!_str_list_append(descendant_str, descendants)) + return_0; + } + if (!_find_descendants(descendants, *glvl->glv, full, include_historical_lvs)) + return_0; + } + } + } else if (lv_is_origin(glv.live)) { + list = &glv.live->snapshot_segs; + dm_list_iterate_items_gen(seg, list, origin_list) { + if ((glv.live = seg->cow)) { + if (!(descendant_str = _get_glv_str(buf, sizeof(buf), &glv))) return_0; - if (!_find_descendants(descendants, descendant_lv)) + if (!_str_list_append(descendant_str, descendants)) + return_0; + if (!_find_descendants(descendants, glv, full, include_historical_lvs)) return_0; } } } else { - dm_list_iterate_items(sl, &lv->segs_using_this_lv) { + list = &glv.live->segs_using_this_lv; + dm_list_iterate_items(sl, list) { if (lv_is_thin_volume(sl->seg->lv)) { seg = first_seg(sl->seg->lv); - if ((seg->origin == lv) || (seg->external_lv == lv)) - descendant_lv = sl->seg->lv; + if ((seg->origin == glv.live) || (seg->external_lv == glv.live)) { + glv_next.live = sl->seg->lv; + if (!(descendant_str = _get_glv_str(buf, sizeof(buf), &glv_next))) + return_0; + if (!_str_list_append(descendant_str, descendants)) + return_0; + if (!_find_descendants(descendants, glv_next, full, include_historical_lvs)) + return_0; + } } + } - if (descendant_lv) { - if (!_str_list_append(descendant_lv->name, descendants)) - return_0; - if (!_find_descendants(descendants, descendant_lv)) + if (full) { + list = &glv.live->indirect_glvs; + dm_list_iterate_items(glvl, list) { + if (!glvl->glv->is_historical || include_historical_lvs) { + if (!(descendant_str = _get_glv_str(buf, sizeof(buf), glvl->glv))) + return_0; + if (!_str_list_append(descendant_str, descendants)) + return_0; + } + if (!_find_descendants(descendants, *glvl->glv, full, include_historical_lvs)) return_0; } } @@ -2073,14 +2110,47 @@ static int _lvdescendants_disp(struct dm_report *rh, struct dm_pool *mem, struct dm_report_field *field, const void *data, void *private) { + struct cmd_context *cmd = (struct cmd_context *) private; struct logical_volume *lv = (struct logical_volume *) data; struct _str_list_append_baton descendants; + struct generic_logical_volume glv; descendants.mem = mem; if (!(descendants.result = str_list_create(mem))) return_0; - if (!_find_descendants(&descendants, lv)) { + if ((glv.is_historical = lv_is_historical(lv))) + glv.historical = lv->this_glv->historical; + else + glv.live = lv; + + if (!_find_descendants(&descendants, glv, 0, cmd->include_historical_lvs)) { + dm_pool_free(descendants.mem, descendants.result); + return_0; + } + + return _field_set_string_list(rh, field, descendants.result, private, 0, NULL); +} + +static int _lvfulldescendants_disp(struct dm_report *rh, struct dm_pool *mem, + struct dm_report_field *field, + const void *data, void *private) +{ + struct cmd_context *cmd = (struct cmd_context *) private; + struct logical_volume *lv = (struct logical_volume *) data; + struct _str_list_append_baton descendants; + struct generic_logical_volume glv; + + descendants.mem = mem; + if (!(descendants.result = str_list_create(mem))) + return_0; + + if ((glv.is_historical = lv_is_historical(lv))) + glv.historical = lv->this_glv->historical; + else + glv.live = lv; + + if (!_find_descendants(&descendants, glv, 1, cmd->include_historical_lvs)) { dm_pool_free(descendants.mem, descendants.result); return_0; }
1
0
0
0
master - report: add full_ancestors field to display ancestors with history
by Peter Rajnoha
03 Mar '16
03 Mar '16
Gitweb:
http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=715f1fb4c4cbdb49…
Commit: 715f1fb4c4cbdb49a86ee95e17070d0ecc548ee0 Parent: f228750386ae4b5b00375e1a14139b53f86f9cca Author: Peter Rajnoha <prajnoha(a)redhat.com> AuthorDate: Tue Mar 1 15:24:40 2016 +0100 Committer: Peter Rajnoha <prajnoha(a)redhat.com> CommitterDate: Thu Mar 3 13:49:15 2016 +0100 report: add full_ancestors field to display ancestors with history The lv_full_ancestors reporting field is just like the existing lv_ancestors field but it also takes into account any history and indirect relations recorded. --- lib/report/columns.h | 3 +- lib/report/properties.c | 2 + lib/report/report.c | 85 +++++++++++++++++++++++++++++++++++++++------- 3 files changed, 76 insertions(+), 14 deletions(-) diff --git a/lib/report/columns.h b/lib/report/columns.h index 11d5639..07ebc44 100644 --- a/lib/report/columns.h +++ b/lib/report/columns.h @@ -65,7 +65,8 @@ FIELD(LVS, lv, NUM, "#Seg", lvid, 4, lvsegcount, seg_count, "Number of segments 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, "Ancestors", lvid, 12, lvancestors, lv_ancestors, "LV ancestors ignoring any stored history of the ancestry chain.", 0) +FIELD(LVS, lv, STR_LIST, "FAncestors", lvid, 12, lvfullancestors, lv_full_ancestors, "LV ancestors including stored history of the ancestry chain.", 0) FIELD(LVS, lv, STR_LIST, "Descendants", lvid, 12, lvdescendants, lv_descendants, "Descendants of this LV.", 0) FIELD(LVS, lv, PCT, "Data%", lvid, 6, datapercent, data_percent, "For snapshot and thin pools and volumes, the percentage full if LV is active.", 0) FIELD(LVS, lv, PCT, "Snap%", lvid, 6, snpercent, snap_percent, "For snapshots, the percentage full if LV is active.", 0) diff --git a/lib/report/properties.c b/lib/report/properties.c index 9c1b23a..c879bc8 100644 --- a/lib/report/properties.c +++ b/lib/report/properties.c @@ -312,6 +312,8 @@ 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 #define _lv_ancestors_get prop_not_implemented_get +#define _lv_full_ancestors_set prop_not_implemented_set +#define _lv_full_ancestors_get prop_not_implemented_get #define _lv_descendants_set prop_not_implemented_set #define _lv_descendants_get prop_not_implemented_get GET_LV_NUM_PROPERTY_FN(snap_percent, _snap_percent(lv)) diff --git a/lib/report/report.c b/lib/report/report.c index dfc76bc..b1ba9fd 100644 --- a/lib/report/report.c +++ b/lib/report/report.c @@ -1929,26 +1929,52 @@ static int _originuuid_disp(struct dm_report *rh, struct dm_pool *mem, return _do_origin_disp(rh, mem, field, data, private, 1); } +static const char *_get_glv_str(char *buf, size_t buf_len, + struct generic_logical_volume *glv) +{ + if (!glv->is_historical) + return glv->live->name; + + if (dm_snprintf(buf, buf_len, "%s%s", HISTORICAL_LV_PREFIX, glv->historical->name) < 0) { + log_error("_get_glv_str: dm_snprintf failed"); + return NULL; + } + + return buf; +} + static int _find_ancestors(struct _str_list_append_baton *ancestors, - struct logical_volume *lv) + struct generic_logical_volume glv, + int full, int include_historical_lvs) { - struct logical_volume *ancestor_lv = NULL; struct lv_segment *seg; - - if (lv_is_cow(lv)) { - ancestor_lv = origin_from_cow(lv); - } else if (lv_is_thin_volume(lv)) { - seg = first_seg(lv); + void *orig_p = glv.live; + const char *ancestor_str; + char buf[NAME_LEN + strlen(HISTORICAL_LV_PREFIX) + 1]; + + if (glv.is_historical) { + if (full && glv.historical->indirect_origin) + glv = *glv.historical->indirect_origin; + } else if (lv_is_cow(glv.live)) { + glv.live = origin_from_cow(glv.live); + } else if (lv_is_thin_volume(glv.live)) { + seg = first_seg(glv.live); if (seg->origin) - ancestor_lv = seg->origin; + glv.live = seg->origin; else if (seg->external_lv) - ancestor_lv = seg->external_lv; + glv.live = seg->external_lv; + else if (full && seg->indirect_origin) + glv = *seg->indirect_origin; } - if (ancestor_lv) { - if (!_str_list_append(ancestor_lv->name, ancestors)) + if (orig_p != glv.live) { + if (!(ancestor_str = _get_glv_str(buf, sizeof(buf), &glv))) return_0; - if (!_find_ancestors(ancestors, ancestor_lv)) + if (!glv.is_historical || include_historical_lvs) { + if (!_str_list_append(ancestor_str, ancestors)) + return_0; + } + if (!_find_ancestors(ancestors, glv, full, include_historical_lvs)) return_0; } @@ -1959,14 +1985,21 @@ static int _lvancestors_disp(struct dm_report *rh, struct dm_pool *mem, struct dm_report_field *field, const void *data, void *private) { + struct cmd_context *cmd = (struct cmd_context *) private; struct logical_volume *lv = (struct logical_volume *) data; struct _str_list_append_baton ancestors; + struct generic_logical_volume glv; ancestors.mem = mem; if (!(ancestors.result = str_list_create(mem))) return_0; - if (!_find_ancestors(&ancestors, lv)) { + if ((glv.is_historical = lv_is_historical(lv))) + glv.historical = lv->this_glv->historical; + else + glv.live = lv; + + if (!_find_ancestors(&ancestors, glv, 0, cmd->include_historical_lvs)) { dm_pool_free(ancestors.mem, ancestors.result); return_0; } @@ -1974,6 +2007,32 @@ static int _lvancestors_disp(struct dm_report *rh, struct dm_pool *mem, return _field_set_string_list(rh, field, ancestors.result, private, 0, NULL); } +static int _lvfullancestors_disp(struct dm_report *rh, struct dm_pool *mem, + struct dm_report_field *field, + const void *data, void *private) +{ + struct cmd_context *cmd = (struct cmd_context *) private; + struct logical_volume *lv = (struct logical_volume *) data; + struct _str_list_append_baton full_ancestors; + struct generic_logical_volume glv; + + full_ancestors.mem = mem; + if (!(full_ancestors.result = str_list_create(mem))) + return_0; + + if ((glv.is_historical = lv_is_historical(lv))) + glv.historical = lv->this_glv->historical; + else + glv.live = lv; + + if (!_find_ancestors(&full_ancestors, glv, 1, cmd->include_historical_lvs)) { + dm_pool_free(full_ancestors.mem, full_ancestors.result); + return_0; + } + + return _field_set_string_list(rh, field, full_ancestors.result, private, 0, NULL); +} + static int _find_descendants(struct _str_list_append_baton *descendants, struct logical_volume *lv) {
1
0
0
0
master - report: report historical LV names with '-' prefix
by Peter Rajnoha
03 Mar '16
03 Mar '16
Gitweb:
http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=f228750386ae4b5b…
Commit: f228750386ae4b5b00375e1a14139b53f86f9cca Parent: 8b9953e8c59ef4c3ced277cc40b8bb5006a24161 Author: Peter Rajnoha <prajnoha(a)redhat.com> AuthorDate: Tue Mar 1 15:24:07 2016 +0100 Committer: Peter Rajnoha <prajnoha(a)redhat.com> CommitterDate: Thu Mar 3 13:49:15 2016 +0100 report: report historical LV names with '-' prefix All names for historical LVs are prefixed with '-' character to make clear difference between live and historical LVs. The '-' can't be set by users for live LV names during lvcreate hence we never get into a conflict with the names that user defines for live LVs. --- lib/report/report.c | 23 ++++++++++++++++------- 1 files changed, 16 insertions(+), 7 deletions(-) diff --git a/lib/report/report.c b/lib/report/report.c index 8ef8eaf..dfc76bc 100644 --- a/lib/report/report.c +++ b/lib/report/report.c @@ -1685,27 +1685,36 @@ static int _lvname_disp(struct dm_report *rh, struct dm_pool *mem, { struct cmd_context *cmd = (struct cmd_context *) private; const struct logical_volume *lv = (const struct logical_volume *) data; + int is_historical = lv_is_historical(lv); + const char *tmp_lvname; char *repstr, *lvname; size_t len; - if (lv_is_historical(lv)) - return _string_disp(rh, mem, field, &lv->this_glv->historical->name, private); - - if (lv_is_visible(lv) || !cmd->report_mark_hidden_devices) + if (!is_historical && (lv_is_visible(lv) || !cmd->report_mark_hidden_devices)) return _field_string(rh, field, lv->name); - len = strlen(lv->name) + 3; + if (is_historical) { + tmp_lvname = lv->this_glv->historical->name; + len = strlen(tmp_lvname) + strlen(HISTORICAL_LV_PREFIX) + 1; + } else { + tmp_lvname = lv->name; + len = strlen(tmp_lvname) + 3; + } + if (!(repstr = dm_pool_zalloc(mem, len))) { log_error("dm_pool_alloc failed"); return 0; } - if (dm_snprintf(repstr, len, "[%s]", lv->name) < 0) { + if (dm_snprintf(repstr, len, "%s%s%s", + is_historical ? HISTORICAL_LV_PREFIX : "[", + tmp_lvname, + is_historical ? "" : "]") < 0) { log_error("lvname snprintf failed"); return 0; } - if (!(lvname = dm_pool_strdup(mem, lv->name))) { + if (!(lvname = dm_pool_strdup(mem, tmp_lvname))) { log_error("dm_pool_strdup failed"); return 0; }
1
0
0
0
master - report: display (h)istorical state in lv_attr field
by Peter Rajnoha
03 Mar '16
03 Mar '16
Gitweb:
http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=8b9953e8c59ef4c3…
Commit: 8b9953e8c59ef4c3ced277cc40b8bb5006a24161 Parent: 2af59715235dedb0ab9f1768d6bbccfdc5d28d02 Author: Peter Rajnoha <prajnoha(a)redhat.com> AuthorDate: Tue Mar 1 15:23:58 2016 +0100 Committer: Peter Rajnoha <prajnoha(a)redhat.com> CommitterDate: Thu Mar 3 13:49:15 2016 +0100 report: display (h)istorical state in lv_attr field The 'historical' state is displayed as 5th bit ("state") in the lv_attr field and denoted by new 'h' character. --- lib/metadata/lv.c | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/metadata/lv.c b/lib/metadata/lv.c index ab937c4..9e9549d 100644 --- a/lib/metadata/lv.c +++ b/lib/metadata/lv.c @@ -1040,7 +1040,7 @@ char *lv_attr_dup_with_info_and_seg_status(struct dm_pool *mem, const struct lv_ } /* Blank if this is a "free space" LV. */ - if (!*lv->name) + if (!*lv->name && !lv_is_historical(lv)) goto out; if (lv_is_pvmove(lv)) @@ -1104,7 +1104,10 @@ char *lv_attr_dup_with_info_and_seg_status(struct dm_pool *mem, const struct lv_ repstr[3] = (lv->status & FIXED_MINOR) ? 'm' : '-'; - if (!activation() || !lvdm->info_ok) { + if (lv_is_historical(lv)) { + repstr[4] = 'h'; + repstr[5] = '-'; + } else if (!activation() || !lvdm->info_ok) { repstr[4] = 'X'; /* Unknown */ repstr[5] = 'X'; /* Unknown */ } else if (lvdm->info.exists) {
1
0
0
0
master - report: add lv_historical field to identify historical LVs
by Peter Rajnoha
03 Mar '16
03 Mar '16
Gitweb:
http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=2af59715235dedb0…
Commit: 2af59715235dedb0ab9f1768d6bbccfdc5d28d02 Parent: e112f5ce05792885ffa5082d7073b139fe468149 Author: Peter Rajnoha <prajnoha(a)redhat.com> AuthorDate: Tue Mar 1 15:23:43 2016 +0100 Committer: Peter Rajnoha <prajnoha(a)redhat.com> CommitterDate: Thu Mar 3 13:49:15 2016 +0100 report: add lv_historical field to identify historical LVs The lv_historical reporting field is a simple binary field that reports whether an LV is historical one ("historical" value or value of "1" displayed) or not (blank string "" or value of "0" displayed). --- lib/report/columns.h | 1 + lib/report/properties.c | 2 ++ lib/report/report.c | 8 ++++++++ 3 files changed, 11 insertions(+), 0 deletions(-) diff --git a/lib/report/columns.h b/lib/report/columns.h index 35c2b2f..11d5639 100644 --- a/lib/report/columns.h +++ b/lib/report/columns.h @@ -96,6 +96,7 @@ FIELD(LVS, lv, TIM, "CTime", lvid, 26, lvtime, lv_time, "Creation time of the LV FIELD(LVS, lv, TIM, "RTime", lvid, 26, lvtimeremoved, lv_time_removed, "Removal time of the LV, if known", 0) FIELD(LVS, lv, STR, "Host", lvid, 10, lvhost, lv_host, "Creation host of the LV, if known.", 0) FIELD(LVS, lv, STR_LIST, "Modules", lvid, 7, modules, lv_modules, "Kernel device-mapper modules required for this LV.", 0) +FIELD(LVS, lv, BIN, "Historical", lvid, 8, lvhistorical, lv_historical, "Set if the LV is historical.", 0) FIELD(LVSINFO, lv, SNUM, "KMaj", lvid, 4, lvkmaj, lv_kernel_major, "Currently assigned major number or -1 if LV is not active.", 0) FIELD(LVSINFO, lv, SNUM, "KMin", lvid, 4, lvkmin, lv_kernel_minor, "Currently assigned minor number or -1 if LV is not active.", 0) diff --git a/lib/report/properties.c b/lib/report/properties.c index 030936b..9c1b23a 100644 --- a/lib/report/properties.c +++ b/lib/report/properties.c @@ -253,6 +253,8 @@ GET_PV_NUM_PROPERTY_FN(pv_ba_size, SECTOR_SIZE * pv->ba_size) #define _lv_skip_activation_get prop_not_implemented_get #define _lv_check_needed_set prop_not_implemented_set #define _lv_check_needed_get prop_not_implemented_get +#define _lv_historical_set prop_not_implemented_set +#define _lv_historical_get prop_not_implemented_get #define _cache_total_blocks_set prop_not_implemented_set #define _cache_total_blocks_get prop_not_implemented_get diff --git a/lib/report/report.c b/lib/report/report.c index 47a911e..8ef8eaf 100644 --- a/lib/report/report.c +++ b/lib/report/report.c @@ -3385,6 +3385,14 @@ static int _lvskipactivation_disp(struct dm_report *rh, struct dm_pool *mem, return _binary_disp(rh, mem, field, skip_activation, "skip activation", private); } +static int _lvhistorical_disp(struct dm_report *rh, struct dm_pool *mem, + struct dm_report_field *field, + const void *data, void *private) +{ + const struct logical_volume *lv = (const struct logical_volume *) data; + return _binary_disp(rh, mem, field, lv_is_historical(lv), "historical", private); +} + /* * Macro to generate '_cache_<cache_status_field_name>_disp' reporting function. * The 'cache_status_field_name' is field name from struct dm_cache_status.
1
0
0
0
master - commands: lvs: recognize -H|--history switch
by Peter Rajnoha
03 Mar '16
03 Mar '16
Gitweb:
http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=e112f5ce05792885…
Commit: e112f5ce05792885ffa5082d7073b139fe468149 Parent: 28f96d5ab617cc41b8aab66c7cb19d750d68d2fd Author: Peter Rajnoha <prajnoha(a)redhat.com> AuthorDate: Tue Mar 1 15:23:34 2016 +0100 Committer: Peter Rajnoha <prajnoha(a)redhat.com> CommitterDate: Thu Mar 3 13:49:14 2016 +0100 commands: lvs: recognize -H|--history switch When lvs command is used together with the -H|--history switch, all historical LVs are reported as well. --- tools/commands.h | 12 +++++++----- 1 files changed, 7 insertions(+), 5 deletions(-) diff --git a/tools/commands.h b/tools/commands.h index 25784bf..ffc15b5 100644 --- a/tools/commands.h +++ b/tools/commands.h @@ -663,6 +663,7 @@ xx(lvs, "\t[-d|--debug]\n" "\t[--foreign]\n" "\t[-h|--help]\n" + "\t[-H|--history]\n" "\t[--ignorelockingfailure]\n" "\t[--ignoreskippedcluster]\n" "\t[--nameprefixes]\n" @@ -684,11 +685,12 @@ xx(lvs, "\t[--version]\n" "\t[LogicalVolume[Path] [LogicalVolume[Path]...]]\n", - aligned_ARG, all_ARG, binary_ARG, foreign_ARG, ignorelockingfailure_ARG, - ignoreskippedcluster_ARG, nameprefixes_ARG, noheadings_ARG, - nolocking_ARG, nosuffix_ARG, options_ARG, partial_ARG, - readonly_ARG, rows_ARG, segments_ARG, select_ARG, separator_ARG, shared_ARG, - sort_ARG, trustcache_ARG, unbuffered_ARG, units_ARG, unquoted_ARG) + aligned_ARG, all_ARG, binary_ARG, foreign_ARG, history_ARG, + ignorelockingfailure_ARG, ignoreskippedcluster_ARG, nameprefixes_ARG, + noheadings_ARG, nolocking_ARG, nosuffix_ARG, options_ARG, partial_ARG, + readonly_ARG, rows_ARG, segments_ARG, select_ARG, separator_ARG, + shared_ARG, sort_ARG, trustcache_ARG, unbuffered_ARG, units_ARG, + unquoted_ARG) xx(lvscan, "List all logical volumes in all volume groups",
1
0
0
0
master - report: display lv_name, lv_uuid, vg_name, lv_time and new lv_time_removed for historical LVs
by Peter Rajnoha
03 Mar '16
03 Mar '16
Gitweb:
http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=28f96d5ab617cc41…
Commit: 28f96d5ab617cc41b8aab66c7cb19d750d68d2fd Parent: 2e7a1210622e25a5a3d813b9a069767eaad3b4ac Author: Peter Rajnoha <prajnoha(a)redhat.com> AuthorDate: Tue Mar 1 15:23:23 2016 +0100 Committer: Peter Rajnoha <prajnoha(a)redhat.com> CommitterDate: Thu Mar 3 13:49:14 2016 +0100 report: display lv_name,lv_uuid,vg_name,lv_time and new lv_time_removed for historical LVs --- lib/display/display.c | 2 +- lib/metadata/lv.c | 23 ++++++++++++++++++++--- lib/metadata/lv.h | 4 +++- lib/report/columns.h | 5 +++-- lib/report/properties.c | 4 +++- lib/report/report.c | 43 +++++++++++++++++++++++++++++++++++++++++-- lib/report/values.h | 1 + 7 files changed, 72 insertions(+), 10 deletions(-) diff --git a/lib/display/display.c b/lib/display/display.c index 0948dda..2b7ea52 100644 --- a/lib/display/display.c +++ b/lib/display/display.c @@ -383,7 +383,7 @@ int lvdisplay_full(struct cmd_context *cmd, log_print("LV UUID %s", uuid); log_print("LV Write Access %s", access_str); log_print("LV Creation host, time %s, %s", - lv_host_dup(cmd->mem, lv), lv_time_dup(cmd->mem, lv, 1)); + lv_host_dup(cmd->mem, lv), lv_creation_time_dup(cmd->mem, lv, 1)); if (lv_is_origin(lv)) { log_print("LV snapshot status source of"); diff --git a/lib/metadata/lv.c b/lib/metadata/lv.c index a5144e9..ab937c4 100644 --- a/lib/metadata/lv.c +++ b/lib/metadata/lv.c @@ -1274,12 +1274,13 @@ int lv_set_creation(struct logical_volume *lv, return 1; } -char *lv_time_dup(struct dm_pool *mem, const struct logical_volume *lv, int iso_mode) +static char *_time_dup(struct cmd_context *cmd, struct dm_pool *mem, + time_t ts, int iso_mode) { char buffer[4096]; struct tm *local_tm; - time_t ts = (time_t)lv->timestamp; - const char *format = iso_mode ? DEFAULT_TIME_FORMAT : lv->vg->cmd->time_format; + const char *format = iso_mode ? DEFAULT_TIME_FORMAT + : cmd->time_format; if (!ts || !(local_tm = localtime(&ts)) || @@ -1289,6 +1290,22 @@ char *lv_time_dup(struct dm_pool *mem, const struct logical_volume *lv, int iso_ return dm_pool_strdup(mem, buffer); } +char *lv_creation_time_dup(struct dm_pool *mem, const struct logical_volume *lv, int iso_mode) +{ + time_t ts = lv_is_historical(lv) ? (time_t) lv->this_glv->historical->timestamp + : (time_t) lv->timestamp; + + return _time_dup(lv->vg->cmd, mem, ts, iso_mode); +} + +char *lv_removal_time_dup(struct dm_pool *mem, const struct logical_volume *lv, int iso_mode) +{ + time_t ts = lv_is_historical(lv) ? (time_t)lv->this_glv->historical->timestamp_removed + : (time_t)0; + + return _time_dup(lv->vg->cmd, mem, ts, iso_mode); +} + char *lv_host_dup(struct dm_pool *mem, const struct logical_volume *lv) { return dm_pool_strdup(mem, lv->hostname ? : ""); diff --git a/lib/metadata/lv.h b/lib/metadata/lv.h index f554bce..f9f5b4e 100644 --- a/lib/metadata/lv.h +++ b/lib/metadata/lv.h @@ -187,10 +187,12 @@ char *lvseg_discards_dup(struct dm_pool *mem, const struct lv_segment *seg); char *lvseg_cachemode_dup(struct dm_pool *mem, const struct lv_segment *seg); char *lvseg_monitor_dup(struct dm_pool *mem, const struct lv_segment *seg); char *lvseg_tags_dup(const struct lv_segment *seg); -char *lv_time_dup(struct dm_pool *mem, const struct logical_volume *lv, int iso_mode); +char *lv_creation_time_dup(struct dm_pool *mem, const struct logical_volume *lv, int iso_mode); +char *lv_removal_time_dup(struct dm_pool *mem, const struct logical_volume *lv, int iso_mode); char *lv_host_dup(struct dm_pool *mem, const struct logical_volume *lv); char *lv_active_dup(struct dm_pool *mem, const struct logical_volume *lv); char *lv_profile_dup(struct dm_pool *mem, const struct logical_volume *lv); char *lv_lock_args_dup(struct dm_pool *mem, const struct logical_volume *lv); char *lvseg_kernel_discards_dup_with_info_and_seg_status(struct dm_pool *mem, const struct lv_with_info_and_seg_status *lvdm); +char *lv_time_dup(struct dm_pool *mem, const struct logical_volume *lv, int iso_mode); #endif /* _LVM_LV_H */ diff --git a/lib/report/columns.h b/lib/report/columns.h index 56a8628..35c2b2f 100644 --- a/lib/report/columns.h +++ b/lib/report/columns.h @@ -32,7 +32,7 @@ */ /* *INDENT-OFF* */ -FIELD(LVS, lv, STR, "LV UUID", lvid.id[1], 38, uuid, lv_uuid, "Unique identifier.", 0) +FIELD(LVS, lv, STR, "LV UUID", lvid, 38, lvuuid, lv_uuid, "Unique identifier.", 0) FIELD(LVS, lv, STR, "LV", lvid, 4, lvname, lv_name, "Name. LVs created for internal use are enclosed in brackets.", 0) FIELD(LVS, lv, STR, "LV", lvid, 4, lvfullname, lv_full_name, "Full name of LV including its VG, namely VG/LV.", 0) FIELD(LVS, lv, STR, "Path", lvid, 4, lvpath, lv_path, "Full pathname for LV. Blank for internal LVs.", 0) @@ -92,7 +92,8 @@ FIELD(LVS, lv, STR, "Pool UUID", lvid, 38, poollvuuid, pool_lv_uuid, "For thin v FIELD(LVS, lv, STR_LIST, "LV Tags", tags, 7, tags, lv_tags, "Tags, if any.", 0) FIELD(LVS, lv, STR, "LProfile", lvid, 8, lvprofile, lv_profile, "Configuration profile attached to this LV.", 0) FIELD(LVS, lv, STR, "Lock Args", lvid, 9, lvlockargs, lv_lockargs, "Lock args of the LV used by lvmlockd.", 0) -FIELD(LVS, lv, TIM, "Time", lvid, 26, lvtime, lv_time, "Creation time of the LV, if known", 0) +FIELD(LVS, lv, TIM, "CTime", lvid, 26, lvtime, lv_time, "Creation time of the LV, if known", 0) +FIELD(LVS, lv, TIM, "RTime", lvid, 26, lvtimeremoved, lv_time_removed, "Removal time of the LV, if known", 0) FIELD(LVS, lv, STR, "Host", lvid, 10, lvhost, lv_host, "Creation host of the LV, if known.", 0) FIELD(LVS, lv, STR_LIST, "Modules", lvid, 7, modules, lv_modules, "Kernel device-mapper modules required for this LV.", 0) diff --git a/lib/report/properties.c b/lib/report/properties.c index 76a72be..030936b 100644 --- a/lib/report/properties.c +++ b/lib/report/properties.c @@ -362,8 +362,10 @@ GET_LV_NUM_PROPERTY_FN(metadata_percent, _metadata_percent(lv)) #define _metadata_percent_set prop_not_implemented_set GET_LV_NUM_PROPERTY_FN(lv_metadata_size, lv_metadata_size(lv) * SECTOR_SIZE) #define _lv_metadata_size_set prop_not_implemented_set -GET_LV_STR_PROPERTY_FN(lv_time, lv_time_dup(lv->vg->vgmem, lv, 0)) +GET_LV_STR_PROPERTY_FN(lv_time, lv_creation_time_dup(lv->vg->vgmem, lv, 0)) #define _lv_time_set prop_not_implemented_set +GET_LV_STR_PROPERTY_FN(lv_time_removed, lv_removal_time_dup(lv->vg->vgmem, lv, 0)) +#define _lv_time_removed_set prop_not_implemented_set GET_LV_STR_PROPERTY_FN(lv_host, lv_host_dup(lv->vg->vgmem, lv)) #define _lv_host_set prop_not_implemented_set GET_LV_STR_PROPERTY_FN(lv_active, lv_active_dup(lv->vg->vgmem, lv)) diff --git a/lib/report/report.c b/lib/report/report.c index 056afd2..47a911e 100644 --- a/lib/report/report.c +++ b/lib/report/report.c @@ -1688,6 +1688,9 @@ static int _lvname_disp(struct dm_report *rh, struct dm_pool *mem, char *repstr, *lvname; size_t len; + if (lv_is_historical(lv)) + return _string_disp(rh, mem, field, &lv->this_glv->historical->name, private); + if (lv_is_visible(lv) || !cmd->report_mark_hidden_devices) return _field_string(rh, field, lv->name); @@ -2463,6 +2466,25 @@ static int _vglockargs_disp(struct dm_report *rh, struct dm_pool *mem, return _field_string(rh, field, vg->lock_args ? : ""); } +static int _lvuuid_disp(struct dm_report *rh __attribute__((unused)), struct dm_pool *mem, + struct dm_report_field *field, + const void *data, void *private __attribute__((unused))) +{ + const struct logical_volume *lv = (const struct logical_volume *) data; + const union lvid *lvid; + char *repstr; + + if (lv_is_historical(lv)) + lvid = &lv->this_glv->historical->lvid; + else + lvid = &lv->lvid; + + if (!(repstr = id_format_and_copy(mem, &lvid->id[1]))) + return_0; + + return _field_set_value(field, repstr, NULL); +} + static int _pvuuid_disp(struct dm_report *rh __attribute__((unused)), struct dm_pool *mem, struct dm_report_field *field, const void *data, void *private __attribute__((unused))) @@ -2851,14 +2873,31 @@ static int _lvtime_disp(struct dm_report *rh, struct dm_pool *mem, char *repstr; uint64_t *sortval; - if (!(repstr = lv_time_dup(mem, lv, 0)) || + if (!(repstr = lv_creation_time_dup(mem, lv, 0)) || !(sortval = dm_pool_alloc(mem, sizeof(uint64_t)))) { log_error("Failed to allocate buffer for time."); return 0; } - *sortval = lv->timestamp; + *sortval = lv_is_historical(lv) ? lv->this_glv->historical->timestamp : lv->timestamp; + return _field_set_value(field, repstr, sortval); +} + +static int _lvtimeremoved_disp(struct dm_report *rh, struct dm_pool *mem, + struct dm_report_field *field, + const void *data, void *private) +{ + const struct logical_volume *lv = (const struct logical_volume *) data; + char *repstr; + uint64_t *sortval; + + if (!(repstr = lv_removal_time_dup(mem, lv, 0)) || + !(sortval = dm_pool_alloc(mem, sizeof(uint64_t)))) { + log_error("Failed to allocate buffer for time."); + return 0; + } + *sortval = lv_is_historical(lv) ? lv->this_glv->historical->timestamp_removed : 0; return _field_set_value(field, repstr, sortval); } diff --git a/lib/report/values.h b/lib/report/values.h index 43c5abe..4a6c235 100644 --- a/lib/report/values.h +++ b/lib/report/values.h @@ -90,6 +90,7 @@ FIELD_RESERVED_VALUE(NAMED, lv_when_full, lv_when_full_error, "", "error", "erro FIELD_RESERVED_VALUE(NAMED, lv_when_full, lv_when_full_queue, "", "queue", "queue", "queue when full", "queue if no space") FIELD_RESERVED_VALUE(NOFLAG, lv_when_full, lv_when_full_undef, "", "", "", "undefined") FIELD_RESERVED_VALUE(NAMED | RANGE | FUZZY | DYNAMIC, lv_time, lv_time_fuzzy, "", lv_time_handler, NULL) +FIELD_RESERVED_VALUE(NAMED | RANGE | FUZZY | DYNAMIC, lv_time_removed, lv_time_removed_fuzzy, "", lv_time_handler, NULL) /* Reserved values for SEG fields */ FIELD_RESERVED_VALUE(NOFLAG, cache_policy, cache_policy_undef, "", "", "", "undefined")
1
0
0
0
← Newer
1
...
11
12
13
14
15
16
17
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
Results per page:
10
25
50
100
200