diff options
author | Peter Rajnoha <prajnoha@redhat.com> | 2015-04-30 17:40:24 +0200 |
---|---|---|
committer | Peter Rajnoha <prajnoha@redhat.com> | 2015-04-30 17:55:04 +0200 |
commit | fc65269d682cb7bcaf14c94ec4541e7af4c27165 (patch) | |
tree | 7462b515ea10be46b60844660b458e14183de7f6 /tools/dumpconfig.c | |
parent | 5a0197121b07b8a2318000872d4b6916c2176ef9 (diff) | |
download | lvm2-fc65269d682cb7bcaf14c94ec4541e7af4c27165.tar.gz |
lvmconfig: add supporting code for handling deprecated settings
This patch adds supporting code for handling deprecated settings.
Deprecated settings are not displayed by default in lvmconfig output
(except for --type current and --type diff). There's a new
"--showdeprecated" lvmconfig option to display them if needed.
Also, when using lvmconfig --withcomments, the comments with info
about deprecation are displayed for deprecated settings and with
lvmconfig --withversions, the version in which the setting was
deprecated is displayed in addition to the version of introduction.
If using --atversion with a version that is lower than the one
in which the setting was deprecated, the setting is then considered
as not deprecated (simply because at that version it was not
deprecated).
For example:
$ lvmconfig --type default activation
activation {
...
raid_region_size=512
...
}
$ lvmconfig --type default activation --showdeprecated
activation {
...
mirror_region_size=512
raid_region_size=512
...
}
$ lvmconfig --type default activation --showdeprecated --withversions
activation {
...
# Available since version 1.0.0.
# Deprecated since version 2.2.99.
mirror_region_size=512
# Available since version 2.2.99.
raid_region_size=512
...
}
$ lvmconfig --type default activation --showdeprecated --withcomments
activation {
...
# Configuration option activation/mirror_region_size.
# This has been replaced by the activation/raid_region_size
# setting.
# Size (in KB) of each copy operation when mirroring.
# This configuration option is deprecated.
mirror_region_size=512
# Configuration option activation/raid_region_size.
# Size in KiB of each raid or mirror synchronization region.
# For raid or mirror segment types, this is the amount of
# data that is copied at once when initializing, or moved
# at once by pvmove.
raid_region_size=512
...
}
$ lvmconfig --type default activation --withcomments --atversion 2.2.98
activation {
...
# Configuration option activation/mirror_region_size.
# Size (in KB) of each copy operation when mirroring.
mirror_region_size=512
...
}
Diffstat (limited to 'tools/dumpconfig.c')
-rw-r--r-- | tools/dumpconfig.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tools/dumpconfig.c b/tools/dumpconfig.c index 6b8f7b022..97de57abd 100644 --- a/tools/dumpconfig.c +++ b/tools/dumpconfig.c @@ -136,6 +136,21 @@ int dumpconfig(struct cmd_context *cmd, int argc, char **argv) tree_spec.ignoreunsupported = 1; } + if (strcmp(type, "current") && strcmp(type, "diff")) { + /* + * By default hide deprecated settings + * for all display types except "current" + * and "diff" unless --showdeprecated is set. + * + * N.B. Deprecated settings are visible if + * --atversion is used with a version that + * is lower than the version in which the + * setting was deprecated. + */ + if (!arg_count(cmd, showdeprecated_ARG)) + tree_spec.ignoredeprecated = 1; + } + if (arg_count(cmd, ignorelocal_ARG)) tree_spec.ignorelocal = 1; |