diff options
author | David Teigland <teigland@redhat.com> | 2014-04-17 12:15:12 -0500 |
---|---|---|
committer | David Teigland <teigland@redhat.com> | 2014-04-17 12:15:12 -0500 |
commit | 8f9c3135e162f7346e840f5b47b7466765f79bb2 (patch) | |
tree | 220e81865dbcb3ded2c35001b30b5c708b85f85a | |
parent | 65f51bfaece8a6a26df90b69885e05ab960b8a8a (diff) | |
download | lvm2-8f9c3135e162f7346e840f5b47b7466765f79bb2.tar.gz |
report: fix printing vg_sysid
The vg->system_id is ususually null.
-rw-r--r-- | lib/report/columns.h | 2 | ||||
-rw-r--r-- | lib/report/report.c | 18 |
2 files changed, 19 insertions, 1 deletions
diff --git a/lib/report/columns.h b/lib/report/columns.h index 1e2f26fdd..bab676b64 100644 --- a/lib/report/columns.h +++ b/lib/report/columns.h @@ -92,7 +92,7 @@ FIELD(VGS, vg, STR, "VG", cmd, 4, vgname, vg_name, "Name.", 0) FIELD(VGS, vg, STR, "Attr", cmd, 5, vgstatus, vg_attr, "Various attributes - see man page.", 0) FIELD(VGS, vg, NUM, "VSize", cmd, 5, vgsize, vg_size, "Total size of VG in current units.", 0) FIELD(VGS, vg, NUM, "VFree", cmd, 5, vgfree, vg_free, "Total amount of free space in current units.", 0) -FIELD(VGS, vg, STR, "SYS ID", system_id, 6, string, vg_sysid, "System ID indicating when and where it was created.", 0) +FIELD(VGS, vg, STR, "SYS ID", cmd, 6, vgsysid, vg_sysid, "System ID indicating when and where it was created.", 0) FIELD(VGS, vg, NUM, "Ext", extent_size, 3, size32, vg_extent_size, "Size of Physical Extents in current units.", 0) FIELD(VGS, vg, NUM, "#Ext", extent_count, 4, uint32, vg_extent_count, "Total number of Physical Extents.", 0) FIELD(VGS, vg, NUM, "Free", free_count, 4, uint32, vg_free_count, "Total number of unallocated Physical Extents.", 0) diff --git a/lib/report/report.c b/lib/report/report.c index 918c320ae..d14416e82 100644 --- a/lib/report/report.c +++ b/lib/report/report.c @@ -298,6 +298,24 @@ static int _vgname_disp(struct dm_report *rh, struct dm_pool *mem, return _field_set_value(field, "", NULL); } +static int _vgsysid_disp(struct dm_report *rh, struct dm_pool *mem, + struct dm_report_field *field, + const void *data, void *private) +{ + const struct volume_group *vg = (const struct volume_group *) data; + const char *sysid; + + if (!vg->system_id) + return _field_set_value(field, "", NULL); + + if (!(sysid = dm_pool_strdup(mem, vg->system_id))) { + log_error("dm_pool_strdup failed"); + return 0; + } + + return dm_report_field_string(rh, field, &sysid); +} + static int _lvname_disp(struct dm_report *rh, struct dm_pool *mem, struct dm_report_field *field, const void *data, void *private __attribute__((unused))) |