diff options
author | Petr Rockai <prockai@redhat.com> | 2013-08-28 14:07:26 +0200 |
---|---|---|
committer | Petr Rockai <prockai@redhat.com> | 2013-11-17 21:43:06 +0100 |
commit | 22942821841da6e84f3fd6c988ed6a3a37401ba6 (patch) | |
tree | 83edf30efa95d92167ef53edda9ae269bcfb2317 | |
parent | d5095222fa4f8cea89b721dcb12adad89176413e (diff) | |
download | lvm2-22942821841da6e84f3fd6c988ed6a3a37401ba6.tar.gz |
reporter: Deal correctly with dummy PVs/labels.
-rw-r--r-- | lib/report/report.c | 2 | ||||
-rw-r--r-- | tools/reporter.c | 12 |
2 files changed, 10 insertions, 4 deletions
diff --git a/lib/report/report.c b/lib/report/report.c index dee4ea2c8..9fd75bb7f 100644 --- a/lib/report/report.c +++ b/lib/report/report.c @@ -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; } diff --git a/tools/reporter.c b/tools/reporter.c index a15f8ef00..28e178c46 100644 --- a/tools/reporter.c +++ b/tools/reporter.c @@ -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; } |