dev-dct-process-part3 - reporter: Deal correctly with dummy PVs/labels.
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=785d5122132450ca206eb187df69125b978af43c Commit: 785d5122132450ca206eb187df69125b978af43c Parent: 53516ea789b8b8f71ac84468f38ce9a0c40f9649 Author: Petr Rockai <[email protected]> AuthorDate: Wed Aug 21 01:31:46 2013 +0200 Committer: Petr Rockai <[email protected]> CommitterDate: Wed Aug 21 01:31:46 2013 +0200
reporter: Deal correctly with dummy PVs/labels.
--- lib/report/report.c | 2 +- tools/reporter.c | 14 +++++++++----- 2 files changed, 10 insertions(+), 6 deletions(-)
lib/report/report.c +1 -1
@@ -146,7 +146,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 -5
@@ -124,11 +124,15 @@ static int _pvsegs_single(struct cmd_context *cmd, struct volume_group *vg,static int _pvs_single (struct cmd_context *cmd,struct volume_group *vg,struct physical_volume *pv,void *handle) { -struct label *label; - - label =pv_label (pv); -if (!label) - return_ECMD_FAILED; +struct label *label =pv_label (pv); +struct label _dummy = {0 }; + +/* FIXME workaround for pv_label going through cache; remove once struct +* physical_volume gains a proper "label" pointer */ +if (!label) { + _dummy.dev = pv->dev; + label = &_dummy; + }if (!report_object (handle, vg,NULL , pv,NULL ,NULL , label)) return_ECMD_FAILED;