summaryrefslogtreecommitdiff
path: root/tools/dumpconfig.c
diff options
context:
space:
mode:
authorPeter Rajnoha <prajnoha@redhat.com>2016-06-02 13:41:55 +0200
committerPeter Rajnoha <prajnoha@redhat.com>2016-06-02 13:49:38 +0200
commit687bc5cecfe6293ee5556aa4e448459bb5c167e6 (patch)
tree525b311f2a1feefe4308ea97d4d564f5d83fb1c2 /tools/dumpconfig.c
parentfc37ee63c0562d3f42b597d485495ee79a857dc5 (diff)
downloadlvm2-687bc5cecfe6293ee5556aa4e448459bb5c167e6.tar.gz
lvmconfig: fix lvmconfig --type diff to display complete diff if config cascade used
If configuration consists of several sources in config cascade ("config cascade" defined in man lvmconfig(8)), lvmconfig displayed only difference from defaults of the topmost config in the cascade. Fix lvmconfig to display complete difference, considering all the configuration in the cascade. For example, before this patch: (use_lvmetad=0 set in lvm.conf which differs from defaults) $ lvmconfig --type diff global { use_lvmetad=0 } (compact_output=1 set on cmd line) $ lvmconfig --type diff --config report/compact_output=1 report { compact_output=1 } (headings=0 set in profile) $ lvmconfig --type diff --commandprofile test report { headings=0 } (difference in topmost configuration source is displayed) $ lvmconfig --type diff --commandprofile test --config report/compact_output=1 report { compact_output=1 } With this patch applied (the config cascade is merged before looking for difference from defaults in configuration): $ lvmconfig --type diff global { use_lvmetad=0 } $ lvmconfig --type diff --config report/compact_output=1 report { compact_output=1 } global { use_lvmetad=0 } $ lvmconfig --type diff --profile test report { headings=0 } global { use_lvmetad=0 } $ lvmconfig --type diff --profile test --config report/compact_output=1 report { headings=0 compact_output=1 } global { use_lvmetad=0 }
Diffstat (limited to 'tools/dumpconfig.c')
-rw-r--r--tools/dumpconfig.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/dumpconfig.c b/tools/dumpconfig.c
index 81b488ed1..088074041 100644
--- a/tools/dumpconfig.c
+++ b/tools/dumpconfig.c
@@ -210,7 +210,7 @@ int dumpconfig(struct cmd_context *cmd, int argc, char **argv)
* Set the 'cft' to work with based on whether we need the plain
* config tree or merged config tree cascade if --mergedconfig is used.
*/
- if ((arg_count(cmd, mergedconfig_ARG) || !strcmp(type, "full")) && cmd->cft->cascade) {
+ if ((arg_count(cmd, mergedconfig_ARG) || !strcmp(type, "full") || !strcmp(type, "diff")) && cmd->cft->cascade) {
if (!_merge_config_cascade(cmd, cmd->cft, &cft)) {
log_error("Failed to merge configuration.");
r = ECMD_FAILED;