diff options
author | Peter Rajnoha <prajnoha@redhat.com> | 2015-06-25 13:03:31 +0200 |
---|---|---|
committer | Peter Rajnoha <prajnoha@redhat.com> | 2015-06-25 13:51:54 +0200 |
commit | 07a34184dba585a4de875035e2acecc9dab1862d (patch) | |
tree | 28e4a22425ba8cfa5e0394acab4102e65a9bca88 | |
parent | c794c163b5800625a116ee53711f4d8db786ff30 (diff) | |
download | lvm2-07a34184dba585a4de875035e2acecc9dab1862d.tar.gz |
lvmconfig: display comment about value from existing config being used
Display comment abour value from existing config being used. For example:
$ lvmconfig --type full --withsummary report/compact_output report/buffered
# Configuration option report/compact_output.
# Do not print empty report fields.
# Value defined in existing configuration has been used for this setting.
compact_output=1
# Configuration option report/buffered.
# Buffer report output.
buffered=1
-rw-r--r-- | lib/config/config.c | 4 | ||||
-rw-r--r-- | man/lvmconfig.8.in | 5 |
2 files changed, 8 insertions, 1 deletions
diff --git a/lib/config/config.c b/lib/config/config.c index fffaace08..4ce97a903 100644 --- a/lib/config/config.c +++ b/lib/config/config.c @@ -1608,6 +1608,10 @@ static int _out_prefix_fn(const struct dm_config_node *cn, const char *line, voi if (cfg_def->flags & CFG_DEFAULT_UNDEFINED) fprintf(out->fp, "%s# This configuration %s does not have a default value defined.\n", line, node_type_name); + + if ((out->tree_spec->type == CFG_DEF_TREE_FULL) && + (out->tree_spec->check_status[cn->id] & CFG_USED)) + fprintf(out->fp, "%s# Value defined in existing configuration has been used for this setting.\n", line); } if (out->tree_spec->withversions) { diff --git a/man/lvmconfig.8.in b/man/lvmconfig.8.in index 6d1b3fc49..bbbeb6da3 100644 --- a/man/lvmconfig.8.in +++ b/man/lvmconfig.8.in @@ -72,7 +72,10 @@ Display full configuration tree - a combination of current configuration tree (\fB\-\-type current\fP) and tree of settings for which default values are used (\fB\-\-type missing\fP). This is exactly the configuration tree that LVM2 uses during command execution. Using this type also implies -the use of \fB\-\-mergedconfig\fP option. +the use of \fB\-\-mergedconfig\fP option. If comments are displayed +(see \fB\-\-withcomments\fP and \fB\-\-withsummary\fP options), then +for each setting found in existing configuration and for which defaults +are not used, there's an extra comment line printed to denote this. .IP list 3 Display plain list of configuration settings. .IP missing 3 |