summaryrefslogtreecommitdiff
path: root/tools/dumpconfig.c
diff options
context:
space:
mode:
authorPeter Rajnoha <prajnoha@redhat.com>2014-02-25 11:05:23 +0100
committerPeter Rajnoha <prajnoha@redhat.com>2014-02-25 11:32:54 +0100
commit558c932444fb4058e1db99147b286bfed72e94d0 (patch)
tree10be68dea7c24023e92049d82093b9a103eea31e /tools/dumpconfig.c
parentd0b5e51d29d5d1c03b3fd561ced3755383d5f4c3 (diff)
downloadlvm2-558c932444fb4058e1db99147b286bfed72e94d0.tar.gz
dumpconfig: comment out config lines without default values defined
To make "lvm dumpconfig --type default" output to be usable like any other config, we need to comment out lines that have no default value defined. Otherwise, we'd have the output with config options with blank or zero values which is not the same as when the value is not defined! And such configuration can't be feed into lvm again without further edits. So let's fix this. Currently this covers these configuration options exactly: devices/loopfiles devices/preferred_names devices/filter devices/global_filter devices/types allocation/cling_tag_list global/format_libraries global/segment_libraries activation/volume_list activation/auto_activation_volume_list activation/read_only_volume_list activation/mlock_filter metadata/dirs metadata/disk_areas metadata/disk_areas/<disk_area> metadata/disk_areas/<disk_area>/start_sector metadata/disk_areas/<disk_area>/size metadata/disk_areas/<disk_area>/id tags/<tag> tags/<tag>/host_list
Diffstat (limited to 'tools/dumpconfig.c')
-rw-r--r--tools/dumpconfig.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/tools/dumpconfig.c b/tools/dumpconfig.c
index 18fba34c2..cb88bc646 100644
--- a/tools/dumpconfig.c
+++ b/tools/dumpconfig.c
@@ -193,6 +193,12 @@ int dumpconfig(struct cmd_context *cmd, int argc, char **argv)
goto out;
}
+ if (arg_count(cmd, withcomments_ARG))
+ tree_spec.withcomments = 1;
+
+ if (arg_count(cmd, withversions_ARG))
+ tree_spec.withversions = 1;
+
if (cft_check_handle)
tree_spec.check_status = cft_check_handle->status;
@@ -202,9 +208,7 @@ int dumpconfig(struct cmd_context *cmd, int argc, char **argv)
goto_out;
}
- if (!config_write(cft, arg_count(cmd, withcomments_ARG),
- arg_count(cmd, withversions_ARG),
- file, argc, argv)) {
+ if (!config_write(cft, &tree_spec, file, argc, argv)) {
stack;
r = ECMD_FAILED;
}