Skip to contentSkip to conversation

master - dumpconfig: add --mergedconfig option

PATCH Peter Rajnoha 1 participant 1 message Jul 8, 2013

lore
Share & tools
lore
#0 lore raw
Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=5ed7d0cf1de4ebea6be8cb67759da40cb61c3913
Commit:        5ed7d0cf1de4ebea6be8cb67759da40cb61c3913
Parent:        f1e289001286f978630f5e6423acca1af322ebd7
Author:        Peter Rajnoha <[email protected]>
AuthorDate:    Mon Jul 8 15:34:27 2013 +0200
Committer:     Peter Rajnoha <[email protected]>
CommitterDate: Mon Jul 8 16:05:56 2013 +0200

dumpconfig: add --mergedconfig option

Normally, the lvm dumpconfig processes only the configuration tree that is at the top of the cascade. Considering the cascade is:

CONFIG_STRING -> CONFIG_PROFILE -> CONFIG_MERGED_FILES/CONFIG_FILE

...then:

(dumpconfig of lvm.conf only)
raw/~ $ lvm dumpconfig allocation

  allocation {
	  maximise_cling=1
	  mirror_logs_require_separate_pvs=0
	  thin_pool_metadata_require_separate_pvs=0
	  thin_pool_chunk_size=64

}

(dumpconfig of selected profile configuration only) raw/~ $ lvm dumpconfig --profile test allocation allocation {
thin_pool_chunk_size=8 thin_pool_discards="passdown" thin_pool_zero=1
}

(dumpconfig of given --config configuration only)
raw/~ $ lvm dumpconfig --config 'allocation{thin_pool_chunk_size=16}' allocation

  allocation {
	  thin_pool_chunk_size=16

}

The --mergedconfig option causes the configuration cascade to be merged before processing it with dumpconfig:

(dumpconfig of merged selected profile and lvm.conf) raw/~ $ lvm dumpconfig --profile test allocation --mergedconfig allocation {
maximise_cling=1
thin_pool_zero=1 thin_pool_discards="passdown" mirror_logs_require_separate_pvs=0 thin_pool_metadata_require_separate_pvs=0 thin_pool_chunk_size=8
}

(dumpconfig merged given --config and selected profile and lvm.conf)
raw/~ $ lvm dumpconfig --profile test --config 'allocation{thin_pool_chunk_size=16}' allocation --mergedconfig

  allocation {
	  maximise_cling=1
	  thin_pool_zero=1
	  thin_pool_discards="passdown"
	  mirror_logs_require_separate_pvs=0
	  thin_pool_metadata_require_separate_pvs=0
	  thin_pool_chunk_size=16

}

Hence with the --mergedconfig, we are able to see the configuration that is actually used when processing any LVM command while using any combination of --config/--profile options together with lvm.conf file.

---
 WHATS_NEW          |    1 +
 tools/args.h       |    1 +
 tools/commands.h   |    3 +-
 tools/dumpconfig.c |   87 ++++++++++++++++++++++++++++++++++++++-------------
 4 files changed, 69 insertions(+), 23 deletions(-)
WHATS_NEW +1 -0
index 567441a..68b3b78 100644
@@ -1,5 +1,6 @@
 Version 2.02.99 - 
 ===================================
+  Add --mergedconfig to lvm dumpconfig for merged --config/--profile/lvm.conf.
   Relase memory and unblock signals in lock_vol error path.
   Define LVM2_* command errors in lvm2cmd.h and use in dmeventd plugins.
   Move errors.h to tools dir.
tools/args.h +1 -0
index 73312ca..ee95ad8 100644
@@ -93,6 +93,7 @@ arg(minrecoveryrate_ARG, '\0', "minrecoveryrate", size_kb_arg, 0)
 arg(maxrecoveryrate_ARG, '\0', "maxrecoveryrate", size_kb_arg, 0)
 arg(profile_ARG, '\0', "profile", string_arg, 0)
 arg(detachprofile_ARG, '\0', "detachprofile", NULL, 0)
+arg(mergedconfig_ARG, '\0', "mergedconfig", NULL, 0)
 
 /* Allow some variations */
 arg(resizable_ARG, '\0', "resizable", yes_no_arg, 0)
tools/commands.h +2 -1
index f84aa35..3f43260 100644
@@ -38,12 +38,13 @@ xx(dumpconfig,
    "\t[--withversions] \n"
    "\t[--ignoreadvanced] \n"
    "\t[--ignoreunsupported] \n"
+   "\t[--mergedconfig] \n"
    "\t[--atversion version]] \n"
    "\t[--validate]\n"
    "\t[ConfigurationNode...]\n",
    file_ARG, configtype_ARG, withcomments_ARG, atversion_ARG,
    withversions_ARG, ignoreadvanced_ARG, ignoreunsupported_ARG,
-   validate_ARG)
+   mergedconfig_ARG, validate_ARG)
 
 xx(formats,
    "List available metadata formats",
tools/dumpconfig.c +65 -22

162 lines not on this page · raw message