summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Rajnoha <prajnoha@redhat.com>2016-05-24 12:05:42 +0200
committerPeter Rajnoha <prajnoha@redhat.com>2016-06-02 14:08:11 +0200
commit2bfee8534b5dd74eb781c6c6dead7ed48efe08aa (patch)
treeca493c05c879c8fbf2a177153488dd584f6d1a81
parent59b2815f52f27d15976158ed5fec74c62cd66b72 (diff)
downloadlvm2-2bfee8534b5dd74eb781c6c6dead7ed48efe08aa.tar.gz
conf: add report/output_format config setting
-rw-r--r--conf/example.conf.in15
-rw-r--r--lib/config/config_settings.h13
-rw-r--r--lib/config/defaults.h1
-rw-r--r--tools/reporter.c4
4 files changed, 31 insertions, 2 deletions
diff --git a/conf/example.conf.in b/conf/example.conf.in
index f4e9ce911..aef692364 100644
--- a/conf/example.conf.in
+++ b/conf/example.conf.in
@@ -1551,6 +1551,21 @@ activation {
# This configuration section has an automatic default value.
# report {
+ # Configuration option report/output_format.
+ # Format of LVM2 command report output.
+ # Accepted values:
+ # native
+ # Original report output with interleaved basic status
+ # messages (like error and warning messages).
+ # extended
+ # Like native, but command status is more detailed, including
+ # per object status and the status is reported as complete
+ # separate report in addition to primary command report.
+ # json
+ # The same as extended, but output is in JSON format.
+ # This configuration option has an automatic default value.
+ # output_format = "native"
+
# Configuration option report/compact_output.
# Do not print empty values for all report fields.
# If enabled, all fields that don't have a value set for any of the
diff --git a/lib/config/config_settings.h b/lib/config/config_settings.h
index 9aacbb06b..39cc518ff 100644
--- a/lib/config/config_settings.h
+++ b/lib/config/config_settings.h
@@ -1462,6 +1462,19 @@ cfg(disk_area_start_sector_CFG, "start_sector", disk_area_CFG_SUBSECTION, CFG_UN
cfg(disk_area_size_CFG, "size", disk_area_CFG_SUBSECTION, CFG_UNSUPPORTED | CFG_DEFAULT_COMMENTED, CFG_TYPE_INT, 0, vsn(1, 0, 0), NULL, 0, NULL, NULL)
cfg(disk_area_id_CFG, "id", disk_area_CFG_SUBSECTION, CFG_UNSUPPORTED | CFG_DEFAULT_UNDEFINED, CFG_TYPE_STRING, NULL, vsn(1, 0, 0), NULL, 0, NULL, NULL)
+cfg(report_output_format_CFG, "output_format", report_CFG_SECTION, CFG_PROFILABLE | CFG_DEFAULT_COMMENTED, CFG_TYPE_STRING, DEFAULT_REP_OUTPUT_FORMAT, vsn(2, 2, 155), NULL, 0, NULL,
+ "Format of LVM2 command report output.\n"
+ "Accepted values:\n"
+ " native\n"
+ " Original report output with interleaved basic status\n"
+ " messages (like error and warning messages).\n"
+ " extended\n"
+ " Like native, but command status is more detailed, including\n"
+ " per object status and the status is reported as complete\n"
+ " separate report in addition to primary command report.\n"
+ " json\n"
+ " The same as extended, but output is in JSON format.\n")
+
cfg(report_compact_output_CFG, "compact_output", report_CFG_SECTION, CFG_PROFILABLE | CFG_DEFAULT_COMMENTED, CFG_TYPE_BOOL, DEFAULT_REP_COMPACT_OUTPUT, vsn(2, 2, 115), NULL, 0, NULL,
"Do not print empty values for all report fields.\n"
"If enabled, all fields that don't have a value set for any of the\n"
diff --git a/lib/config/defaults.h b/lib/config/defaults.h
index b57315b2f..295c657bf 100644
--- a/lib/config/defaults.h
+++ b/lib/config/defaults.h
@@ -207,6 +207,7 @@
#define DEFAULT_REP_LIST_ITEM_SEPARATOR ","
#define DEFAULT_TIME_FORMAT "%Y-%m-%d %T %z"
+#define DEFAULT_REP_OUTPUT_FORMAT "native"
#define DEFAULT_COMPACT_OUTPUT_COLS ""
#define DEFAULT_LVS_COLS "lv_name,vg_name,lv_attr,lv_size,pool_lv,origin,data_percent,metadata_percent,move_pv,mirror_log,copy_percent,convert_lv"
diff --git a/tools/reporter.c b/tools/reporter.c
index 8a5974709..27cb125de 100644
--- a/tools/reporter.c
+++ b/tools/reporter.c
@@ -1076,8 +1076,8 @@ int report_format_init(struct cmd_context *cmd, struct dm_report_group **report_
struct dm_report_group *new_report_group;
struct dm_report *tmp_status_rh = NULL;
- if (!(format_str = arg_str_value(cmd, reportformat_ARG, NULL)))
- return 1;
+ if (!(format_str = arg_str_value(cmd, reportformat_ARG, find_config_tree_str(cmd, report_output_format_CFG, NULL))))
+ return_0;
if (!strcmp(format_str, REPORT_FORMAT_NAME_NATIVE))
return 1;