master - reporter: Deal correctly with dummy PVs/labels.
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=22942821841da6e84f3fd6c988ed6a3a37401ba6 Commit: 22942821841da6e84f3fd6c988ed6a3a37401ba6 Parent: d5095222fa4f8cea89b721dcb12adad89176413e Author: Petr Rockai <[email protected]> AuthorDate: Wed Aug 28 14:07:26 2013 +0200 Committer: Petr Rockai <[email protected]> CommitterDate: Sun Nov 17 21:43:06 2013 +0100
reporter: Deal correctly with dummy PVs/labels.
--- lib/report/report.c | 2 +- tools/reporter.c | 12 +++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-)
lib/report/report.c +1 -1
@@ -184,7 +184,7 @@ static int _pvfmt_disp(struct dm_report *rh, struct dm_pool *mem,const struct label *l = (const struct label *) data; -if (!l->labeller->fmt) { +if (!l->labeller || !l->labeller->fmt) {dm_report_field_set_value (field,"" ,NULL );return 1 ; }
tools/reporter.c +9 -3
@@ -141,6 +141,7 @@ static int _pvs_single(struct cmd_context *cmd, struct volume_group *vg,struct volume_group *old_vg = vg; char uuid[64] __attribute__((aligned(8)));struct label *label; +struct label _dummy_label = {0 };if (is_pv (pv) && !is_orphan (pv) && !vg) { vg_name =pv_vg_name (pv);
@@ -178,9 +179,14 @@ static int _pvs_single(struct cmd_context *cmd, struct volume_group *vg, pv = pvl->pv; } -if ((!(label =pv_label (pv))) || - (!report_object (handle, vg,NULL , pv,NULL ,NULL , label))) - { +/* FIXME workaround for pv_label going through cache; remove once struct +* physical_volume gains a proper "label" pointer */ +if (!(label =pv_label (pv))) { + _dummy_label.dev = pv->dev; + label = &_dummy_label; + } + +if (!report_object (handle, vg,NULL , pv,NULL ,NULL , label)) { stack; ret =ECMD_FAILED ; }