summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPetr Rockai <prockai@redhat.com>2013-08-28 14:07:26 +0200
committerPetr Rockai <prockai@redhat.com>2013-08-28 14:54:33 +0200
commit128ae783a22ec3dfb53160f92a377427baaab40f (patch)
tree65c7127e0c6a1fcc3f96ce85abcf65ae12760ba5
parentb40c513b025d64fd7e144c1da2a61ade43f32358 (diff)
downloadlvm2-128ae783a22ec3dfb53160f92a377427baaab40f.tar.gz
reporter: Deal correctly with dummy PVs/labels.
-rw-r--r--lib/report/report.c2
-rw-r--r--tools/reporter.c12
2 files changed, 10 insertions, 4 deletions
diff --git a/lib/report/report.c b/lib/report/report.c
index 07d4731d5..107442d7a 100644
--- a/lib/report/report.c
+++ b/lib/report/report.c
@@ -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;
}
diff --git a/tools/reporter.c b/tools/reporter.c
index 5602883fb..ac5ff6948 100644
--- a/tools/reporter.c
+++ b/tools/reporter.c
@@ -130,6 +130,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);
@@ -167,9 +168,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;
}