summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Rajnoha <prajnoha@redhat.com>2014-12-05 11:46:26 +0100
committerPeter Rajnoha <prajnoha@redhat.com>2014-12-05 12:00:28 +0100
commit00d53d5fc172ee396ea835a110126f83202724d5 (patch)
tree900786ece6993c022e7ef147f0dae04c3775724f
parent5edf6a56c4077edd238bf08bf369e7d82bca4ecf (diff)
downloadlvm2-00d53d5fc172ee396ea835a110126f83202724d5.tar.gz
config: add report/compact_output lvm.conf setting to enable or isable field compacting
$ lvm dumpconfig report/compact_output compact_output=0 $ lvs vg LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert lvol0 vg owi-a-s--- 4.00m lvol1 vg -wi-a----- 4.00m lvol2 vg swi-a-s--- 4.00m lvol0 0.00 $ lvm dumpconfig report/compact_output compact_output=1 $ lvs vg LV VG Attr LSize Origin Data% lvol0 vg owi-a-s--- 4.00m lvol1 vg -wi-a----- 4.00m lvol2 vg swi-a-s--- 4.00m lvol0 0.00
-rw-r--r--WHATS_NEW1
-rw-r--r--conf/example.conf.in4
-rw-r--r--lib/config/config_settings.h1
-rw-r--r--lib/config/defaults.h1
-rw-r--r--tools/reporter.c5
5 files changed, 12 insertions, 0 deletions
diff --git a/WHATS_NEW b/WHATS_NEW
index 54e46d9db..11fa6e1f2 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.115 -
=====================================
+ Add report/compact_output to lvm.conf to enable/disable compact report output.
Still restrict mirror region size to power of 2 when VG extent size is not.
Version 2.02.114 - 28th November 2014
diff --git a/conf/example.conf.in b/conf/example.conf.in
index d1a139717..5ed2b9253 100644
--- a/conf/example.conf.in
+++ b/conf/example.conf.in
@@ -1104,6 +1104,10 @@ activation {
# Report settings.
#
# report {
+ # If compact output is enabled, fields which don't have value
+ # set for any of the rows reported are skipped on output.
+ # compact_output=0
+
# Align columns on report output.
# aligned=1
diff --git a/lib/config/config_settings.h b/lib/config/config_settings.h
index e944b81b8..6de948e86 100644
--- a/lib/config/config_settings.h
+++ b/lib/config/config_settings.h
@@ -234,6 +234,7 @@ cfg(disk_area_start_sector_CFG, "start_sector", disk_area_CFG_SUBSECTION, CFG_AD
cfg(disk_area_size_CFG, "size", disk_area_CFG_SUBSECTION, CFG_ADVANCED | CFG_UNSUPPORTED | CFG_DEFAULT_UNDEFINED, CFG_TYPE_INT, 0, vsn(1, 0, 0), NULL)
cfg(disk_area_id_CFG, "id", disk_area_CFG_SUBSECTION, CFG_ADVANCED | CFG_UNSUPPORTED | CFG_DEFAULT_UNDEFINED, CFG_TYPE_STRING, NULL, vsn(1, 0, 0), NULL)
+cfg(report_compact_output_CFG, "compact_output", report_CFG_SECTION, CFG_PROFILABLE, CFG_TYPE_BOOL, DEFAULT_REP_COMPACT_OUTPUT, vsn(2, 2, 115), NULL)
cfg(report_aligned_CFG, "aligned", report_CFG_SECTION, CFG_PROFILABLE, CFG_TYPE_BOOL, DEFAULT_REP_ALIGNED, vsn(1, 0, 0), NULL)
cfg(report_buffered_CFG, "buffered", report_CFG_SECTION, CFG_PROFILABLE, CFG_TYPE_BOOL, DEFAULT_REP_BUFFERED, vsn(1, 0, 0), NULL)
cfg(report_headings_CFG, "headings", report_CFG_SECTION, CFG_PROFILABLE, CFG_TYPE_BOOL, DEFAULT_REP_HEADINGS, vsn(1, 0, 0), NULL)
diff --git a/lib/config/defaults.h b/lib/config/defaults.h
index cbc95fb77..e15926c49 100644
--- a/lib/config/defaults.h
+++ b/lib/config/defaults.h
@@ -176,6 +176,7 @@
#define DEFAULT_MAX_ERROR_COUNT NO_DEV_ERROR_COUNT_LIMIT
+#define DEFAULT_REP_COMPACT_OUTPUT 0
#define DEFAULT_REP_ALIGNED 1
#define DEFAULT_REP_BUFFERED 1
#define DEFAULT_REP_COLUMNS_AS_ROWS 0
diff --git a/tools/reporter.c b/tools/reporter.c
index eec9948a1..b3125680d 100644
--- a/tools/reporter.c
+++ b/tools/reporter.c
@@ -410,6 +410,7 @@ static int _report(struct cmd_context *cmd, int argc, char **argv,
args_are_pvs = (report_type == PVS ||
report_type == LABEL ||
+
report_type == PVSEGS) ? 1 : 0;
/*
@@ -614,6 +615,10 @@ static int _report(struct cmd_context *cmd, int argc, char **argv,
break;
}
+ if (find_config_tree_bool(cmd, report_compact_output_CFG, NULL) &&
+ !dm_report_compact_fields(report_handle))
+ log_error("Failed to compact report output.");
+
dm_report_output(report_handle);
dm_report_free(report_handle);