diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/log/log.c | 14 | ||||
-rw-r--r-- | lib/log/log.h | 2 | ||||
-rw-r--r-- | lib/metadata/metadata.c | 3 | ||||
-rw-r--r-- | lib/report/report.c | 6 |
4 files changed, 24 insertions, 1 deletions
diff --git a/lib/log/log.c b/lib/log/log.c index f32e56ea..e8806619 100644 --- a/lib/log/log.c +++ b/lib/log/log.c @@ -51,6 +51,7 @@ static int _already_logging = 0; static int _mirror_in_sync = 0; static int _dmeventd_monitor = DEFAULT_DMEVENTD_MONITOR; static int _ignore_suspended_devices = 0; +static int _error_message_produced = 0; static lvm2_log_fn_t _lvm2_log_fn = NULL; @@ -238,6 +239,16 @@ void init_indent(int indent) _indent = indent; } +void init_error_message_produced(int error_message_produced) +{ + _error_message_produced = error_message_produced; +} + +int error_message_produced(void) +{ + return _error_message_produced; +} + int test_mode() { return _test; @@ -322,6 +333,9 @@ void print_log(int level, const char *file, int line, const char *format, ...) if (_log_suppress == 2) return; + if (level <= _LOG_ERR) + _error_message_produced = 1; + trformat = _(format); if (_lvm2_log_fn) { diff --git a/lib/log/log.h b/lib/log/log.h index d5e0664e..8b85758b 100644 --- a/lib/log/log.h +++ b/lib/log/log.h @@ -79,6 +79,7 @@ void init_security_level(int level); void init_mirror_in_sync(int in_sync); void init_dmeventd_monitor(int reg); void init_ignore_suspended_devices(int ignore); +void init_error_message_produced(int error_message_produced); void set_cmd_name(const char *cmd_name); @@ -94,6 +95,7 @@ int lockingfailed(void); int security_level(void); int mirror_in_sync(void); int ignore_suspended_devices(void); +int error_message_produced(void); #define DMEVENTD_MONITOR_IGNORE -1 int dmeventd_monitor_mode(void); diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c index 8fc39515..d385814a 100644 --- a/lib/metadata/metadata.c +++ b/lib/metadata/metadata.c @@ -1213,10 +1213,11 @@ int vg_validate(struct volume_group *vg) if ((lv_count = (uint32_t) list_size(&vg->lvs)) != vg->lv_count + 2 * vg->snapshot_count) { - log_debug("Internal error: #internal LVs (%u) != #LVs (%" + log_error("Internal error: #internal LVs (%u) != #LVs (%" PRIu32 ") + 2 * #snapshots (%" PRIu32 ") in VG %s", list_size(&vg->lvs), vg->lv_count, vg->snapshot_count, vg->name); + r = 0; } list_iterate_items(lvl, &vg->lvs) { diff --git a/lib/report/report.c b/lib/report/report.c index d067bd30..f2ffd982 100644 --- a/lib/report/report.c +++ b/lib/report/report.c @@ -1091,9 +1091,15 @@ void *report_init(struct cmd_context *cmd, const char *format, const char *keys, if (headings) report_flags |= DM_REPORT_OUTPUT_HEADINGS; + if (field_prefixes) + report_flags |= DM_REPORT_OUTPUT_FIELD_NAME_PREFIX; + rh = dm_report_init(report_type, _report_types, _fields, format, separator, report_flags, keys, cmd); + if (field_prefixes) + dm_report_set_output_field_name_prefix(rh, "lvm2_"); + return rh; } |