1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

dumpconfig: add --ignorelocal

When generating a sample lvm.conf file, we don't want to
include the "local" section, which is kept in lvmlocal.conf.
This commit is contained in:
David Teigland 2015-04-21 14:53:54 -05:00
parent 0d0d50182d
commit 9b86e8e8f4
7 changed files with 16 additions and 1 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.119 - Version 2.02.119 -
================================== ==================================
Add --ignorelocal option to dumpconfig to ignore the local section.
Close connection to lvmetad after fork. Close connection to lvmetad after fork.
Make lvchange able to resume background pvmove polling again. Make lvchange able to resume background pvmove polling again.
Split pvmove update metadata fn in an initial one and a subsequent one. Split pvmove update metadata fn in an initial one and a subsequent one.

View File

@ -1817,6 +1817,9 @@ struct dm_config_tree *config_def_create_tree(struct config_def_tree_spec *spec)
if (cfg_def_get_item_p(id)->parent != root_CFG_SECTION) if (cfg_def_get_item_p(id)->parent != root_CFG_SECTION)
continue; continue;
if (spec->ignorelocal && (id == local_CFG_SECTION))
continue;
if ((tmp = _add_def_section_subtree(cft, spec, root, relay, id))) { if ((tmp = _add_def_section_subtree(cft, spec, root, relay, id))) {
relay = tmp; relay = tmp;
if (!root) if (!root)

View File

@ -145,6 +145,7 @@ struct config_def_tree_spec {
uint16_t version; /* tree at this LVM2 version */ uint16_t version; /* tree at this LVM2 version */
unsigned ignoreadvanced:1; /* do not include advanced configs */ unsigned ignoreadvanced:1; /* do not include advanced configs */
unsigned ignoreunsupported:1; /* do not include unsupported configs */ unsigned ignoreunsupported:1; /* do not include unsupported configs */
unsigned ignorelocal:1; /* do not include the local section */
unsigned withcomments:1; /* include first line of comment */ unsigned withcomments:1; /* include first line of comment */
unsigned withfullcomments:1; /* include all comment lines */ unsigned withfullcomments:1; /* include all comment lines */
unsigned withversions:1; /* include versions */ unsigned withversions:1; /* include versions */

View File

@ -11,6 +11,7 @@ lvm-dumpconfig \(em dump LVM configuration
.IR version ] .IR version ]
.RB [ \-\-ignoreadvanced ] .RB [ \-\-ignoreadvanced ]
.RB [ \-\-ignoreunsupported ] .RB [ \-\-ignoreunsupported ]
.RB [ \-\-ignorelocal ]
.RB [ \-\-config .RB [ \-\-config
.IR ConfigurationString ] .IR ConfigurationString ]
.RB [ \-\-commandprofile .RB [ \-\-commandprofile
@ -94,6 +95,10 @@ Ignore unsupported configuration settings on dump. These settings are
either used for debugging purposes only or their support is not yet either used for debugging purposes only or their support is not yet
complete and they are not meant to be used in production. complete and they are not meant to be used in production.
.TP
.B \-\-ignorelocal
Ignore local section.
.TP .TP
.BI \-\-config " ConfigurationString" .BI \-\-config " ConfigurationString"
Use \fBConfigurationString\fP to override existing configuration. Use \fBConfigurationString\fP to override existing configuration.

View File

@ -43,6 +43,7 @@ arg(errorwhenfull_ARG, '\0', "errorwhenfull", yes_no_arg, 0)
arg(force_long_ARG, '\0', "force", NULL, ARG_COUNTABLE) arg(force_long_ARG, '\0', "force", NULL, ARG_COUNTABLE)
arg(foreign_ARG, '\0', "foreign", NULL, 0) arg(foreign_ARG, '\0', "foreign", NULL, 0)
arg(ignoreadvanced_ARG, '\0', "ignoreadvanced", NULL, 0) arg(ignoreadvanced_ARG, '\0', "ignoreadvanced", NULL, 0)
arg(ignorelocal_ARG, '\0', "ignorelocal", NULL, 0)
arg(ignorelockingfailure_ARG, '\0', "ignorelockingfailure", NULL, 0) arg(ignorelockingfailure_ARG, '\0', "ignorelockingfailure", NULL, 0)
arg(ignoremonitoring_ARG, '\0', "ignoremonitoring", NULL, 0) arg(ignoremonitoring_ARG, '\0', "ignoremonitoring", NULL, 0)
arg(ignoreskippedcluster_ARG, '\0', "ignoreskippedcluster", NULL, 0) arg(ignoreskippedcluster_ARG, '\0', "ignoreskippedcluster", NULL, 0)

View File

@ -63,6 +63,7 @@ xx(dumpconfig,
"\t[--atversion version]]\n" "\t[--atversion version]]\n"
"\t[--ignoreadvanced]\n" "\t[--ignoreadvanced]\n"
"\t[--ignoreunsupported]\n" "\t[--ignoreunsupported]\n"
"\t[--ignorelocal]\n"
"\t[--config ConfigurationString]\n" "\t[--config ConfigurationString]\n"
"\t[--commandprofile ProfileName]\n" "\t[--commandprofile ProfileName]\n"
"\t[--profile ProfileName]\n" "\t[--profile ProfileName]\n"
@ -75,7 +76,7 @@ xx(dumpconfig,
"\t[--withversions]\n" "\t[--withversions]\n"
"\t[ConfigurationNode...]\n", "\t[ConfigurationNode...]\n",
atversion_ARG, configtype_ARG, file_ARG, ignoreadvanced_ARG, atversion_ARG, configtype_ARG, file_ARG, ignoreadvanced_ARG,
ignoreunsupported_ARG, mergedconfig_ARG, metadataprofile_ARG, ignoreunsupported_ARG, ignorelocal_ARG, mergedconfig_ARG, metadataprofile_ARG,
validate_ARG, withcomments_ARG, withfullcomments_ARG, unconfigured_ARG, withversions_ARG) validate_ARG, withcomments_ARG, withfullcomments_ARG, unconfigured_ARG, withversions_ARG)
xx(formats, xx(formats,

View File

@ -113,6 +113,9 @@ int dumpconfig(struct cmd_context *cmd, int argc, char **argv)
if (arg_count(cmd, ignoreunsupported_ARG)) if (arg_count(cmd, ignoreunsupported_ARG))
tree_spec.ignoreunsupported = 1; tree_spec.ignoreunsupported = 1;
if (arg_count(cmd, ignorelocal_ARG))
tree_spec.ignorelocal = 1;
if (!strcmp(type, "current")) { if (!strcmp(type, "current")) {
if (arg_count(cmd, atversion_ARG)) { if (arg_count(cmd, atversion_ARG)) {
log_error("--atversion has no effect with --type current"); log_error("--atversion has no effect with --type current");