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

refactor: dumpconfig: keep --withcomments to display full comment and use --withsummary for one line summary

This commit is contained in:
Peter Rajnoha 2015-04-29 10:53:25 +02:00
parent 15a563c376
commit 0ba332e82a
9 changed files with 25 additions and 25 deletions

View File

@ -8,7 +8,7 @@ Version 2.02.119 -
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.
Refactor shared pvmove and lvconvert code into new _poll files. Refactor shared pvmove and lvconvert code into new _poll files.
Add --unconfigured option to dumpconfig to print strings unconfigured. Add --unconfigured option to dumpconfig to print strings unconfigured.
Add --withfullcomments option to dumpconfig to print full comment. Add --withsummary option to dumpconfig to print first line - summary comment.
Check for lvm binary in blkdeactivate and skip LVM processing if not present. Check for lvm binary in blkdeactivate and skip LVM processing if not present.
Add --enable-halvm and --disable-halvm options to lvmconf script. Add --enable-halvm and --disable-halvm options to lvmconf script.
Add --services, --mirrorservice and --startstopservices option to lvmconf. Add --services, --mirrorservice and --startstopservices option to lvmconf.

View File

@ -27,8 +27,8 @@ include $(top_builddir)/make.tmpl
.PHONY: install_conf install_localconf install_profiles .PHONY: install_conf install_localconf install_profiles
generate: generate:
(cat $(top_srcdir)/conf/example.conf.base && LD_LIBRARY_PATH=$(top_builddir)/libdm:$(LD_LIBRARY_PATH) $(top_builddir)/tools/lvm dumpconfig --type default --unconfigured --withfullcomments --ignorelocal) > example.conf.in (cat $(top_srcdir)/conf/example.conf.base && LD_LIBRARY_PATH=$(top_builddir)/libdm:$(LD_LIBRARY_PATH) $(top_builddir)/tools/lvm dumpconfig --type default --unconfigured --withcomments --ignorelocal) > example.conf.in
(cat $(top_srcdir)/conf/lvmlocal.conf.base && LD_LIBRARY_PATH=$(top_builddir)/libdm:$(LD_LIBRARY_PATH) $(top_builddir)/tools/lvm dumpconfig --type default --unconfigured --withfullcomments local) > lvmlocal.conf.in (cat $(top_srcdir)/conf/lvmlocal.conf.base && LD_LIBRARY_PATH=$(top_builddir)/libdm:$(LD_LIBRARY_PATH) $(top_builddir)/tools/lvm dumpconfig --type default --unconfigured --withcomments local) > lvmlocal.conf.in
install_conf: $(CONFSRC) install_conf: $(CONFSRC)
@if [ ! -e $(confdir)/$(CONFDEST) ]; then \ @if [ ! -e $(confdir)/$(CONFDEST) ]; then \

View File

@ -1542,7 +1542,7 @@ static int _out_prefix_fn(const struct dm_config_node *cn, const char *line, voi
cfg_def = cfg_def_get_item_p(cn->id); cfg_def = cfg_def_get_item_p(cn->id);
if (out->tree_spec->withcomments || out->tree_spec->withfullcomments) { if (out->tree_spec->withsummary || out->tree_spec->withcomments) {
_cfg_def_make_path(path, sizeof(path), cfg_def->id, cfg_def, 1); _cfg_def_make_path(path, sizeof(path), cfg_def->id, cfg_def, 1);
fprintf(out->fp, "\n"); fprintf(out->fp, "\n");
fprintf(out->fp, "%s# Configuration %s %s.\n", line, node_type_name, path); fprintf(out->fp, "%s# Configuration %s %s.\n", line, node_type_name, path);
@ -1551,8 +1551,8 @@ static int _out_prefix_fn(const struct dm_config_node *cn, const char *line, voi
int pos = 0; int pos = 0;
while (_copy_one_line(cfg_def->comment, commentline, &pos, strlen(cfg_def->comment))) { while (_copy_one_line(cfg_def->comment, commentline, &pos, strlen(cfg_def->comment))) {
fprintf(out->fp, "%s# %s\n", line, commentline); fprintf(out->fp, "%s# %s\n", line, commentline);
/* withcomments prints only the first comment line. */ /* withsummary prints only the first comment line. */
if (!out->tree_spec->withfullcomments) if (!out->tree_spec->withcomments)
break; break;
} }
} }

View File

@ -152,8 +152,8 @@ struct config_def_tree_spec {
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 ignorelocal:1; /* do not include the local section */
unsigned withcomments:1; /* include first line of comment */ unsigned withsummary:1; /* include first line of comments - a summary */
unsigned withfullcomments:1; /* include all comment lines */ unsigned withcomments:1; /* include all comment lines */
unsigned withversions:1; /* include versions */ unsigned withversions:1; /* include versions */
unsigned unconfigured:1; /* use unconfigured path strings */ unsigned unconfigured:1; /* use unconfigured path strings */
uint8_t *check_status; /* status of last tree check (currently needed for CFG_DEF_TREE_MISSING only) */ uint8_t *check_status; /* status of last tree check (currently needed for CFG_DEF_TREE_MISSING only) */

View File

@ -171,7 +171,7 @@ default values:
Command to print a list of all possible config settings, with their Command to print a list of all possible config settings, with their
default values, and a full description of each as a comment: default values, and a full description of each as a comment:
.br .br
.B lvmconfig \-\-type default --withfullcomments .B lvmconfig \-\-type default --withcomments
Command to print a list of all possible config settings, with their Command to print a list of all possible config settings, with their
current values (configured, non-default values are shown): current values (configured, non-default values are shown):
@ -189,7 +189,7 @@ and a full description, where "Section" refers to the config section,
e.g. global, and "Setting" refers to the name of the specific setting, e.g. global, and "Setting" refers to the name of the specific setting,
e.g. umask: e.g. umask:
.br .br
.B lvmconfig \-\-type default --withfullcomments Section/Setting .B lvmconfig \-\-type default --withcomments Section/Setting
.SH FILES .SH FILES

View File

@ -22,8 +22,8 @@ lvmconfig, lvm dumpconfig, lvm config \(em Display LVM configuration
.IR ProfileName ] .IR ProfileName ]
.RB [ \-\-mergedconfig ] .RB [ \-\-mergedconfig ]
.RB [ \-\-validate ] .RB [ \-\-validate ]
.RB [ \-\-withsummary ]
.RB [ \-\-withcomments ] .RB [ \-\-withcomments ]
.RB [ \-\-withfullcomments ]
.RB [ \-\-withversions ] .RB [ \-\-withversions ]
.RB [ ConfigurationNode... ] .RB [ ConfigurationNode... ]
@ -148,11 +148,11 @@ The validation is done even if \fBconfig/checks\fP \fBlvm.conf\fP(5)
option is disabled. option is disabled.
.TP .TP
.B \-\-withcomments .B \-\-withsummary
Display a one line comment for each configuration node. Display a one line comment for each configuration node.
.TP .TP
.B \-\-withfullcomments .B \-\-withcomments
Display a full comment for each configuration node. Display a full comment for each configuration node.
.TP .TP

View File

@ -118,8 +118,8 @@ arg(validate_ARG, '\0', "validate", NULL, 0)
arg(version_ARG, '\0', "version", NULL, 0) arg(version_ARG, '\0', "version", NULL, 0)
arg(vgmetadatacopies_ARG, '\0', "vgmetadatacopies", metadatacopies_arg, 0) arg(vgmetadatacopies_ARG, '\0', "vgmetadatacopies", metadatacopies_arg, 0)
arg(virtualoriginsize_ARG, '\0', "virtualoriginsize", size_mb_arg, 0) arg(virtualoriginsize_ARG, '\0', "virtualoriginsize", size_mb_arg, 0)
arg(withsummary_ARG, '\0', "withsummary", NULL, 0)
arg(withcomments_ARG, '\0', "withcomments", NULL, 0) arg(withcomments_ARG, '\0', "withcomments", NULL, 0)
arg(withfullcomments_ARG, '\0', "withfullcomments", NULL, 0)
arg(withversions_ARG, '\0', "withversions", NULL, 0) arg(withversions_ARG, '\0', "withversions", NULL, 0)
arg(writebehind_ARG, '\0', "writebehind", int_arg, 0) arg(writebehind_ARG, '\0', "writebehind", int_arg, 0)
arg(writemostly_ARG, '\0', "writemostly", string_arg, ARG_GROUPABLE) arg(writemostly_ARG, '\0', "writemostly", string_arg, ARG_GROUPABLE)

View File

@ -44,14 +44,14 @@ xx(config,
"\t[--metadataprofile ProfileName]\n" "\t[--metadataprofile ProfileName]\n"
"\t[--mergedconfig]\n" "\t[--mergedconfig]\n"
"\t[--validate]\n" "\t[--validate]\n"
"\t[--withsummary]\n"
"\t[--withcomments]\n" "\t[--withcomments]\n"
"\t[--withfullcomments]\n"
"\t[--unconfigured]\n" "\t[--unconfigured]\n"
"\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, ignorelocal_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, withsummary_ARG, withcomments_ARG, unconfigured_ARG, withversions_ARG)
xx(devtypes, xx(devtypes,
"Display recognised built-in block device types", "Display recognised built-in block device types",
@ -95,14 +95,14 @@ xx(dumpconfig,
"\t[--metadataprofile ProfileName]\n" "\t[--metadataprofile ProfileName]\n"
"\t[--mergedconfig]\n" "\t[--mergedconfig]\n"
"\t[--validate]\n" "\t[--validate]\n"
"\t[--withsummary]\n"
"\t[--withcomments]\n" "\t[--withcomments]\n"
"\t[--withfullcomments]\n"
"\t[--unconfigured]\n" "\t[--unconfigured]\n"
"\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, ignorelocal_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, withsummary_ARG, withcomments_ARG, unconfigured_ARG, withversions_ARG)
xx(formats, xx(formats,
"List available metadata formats", "List available metadata formats",
@ -495,14 +495,14 @@ xx(lvmconfig,
"\t[--metadataprofile ProfileName]\n" "\t[--metadataprofile ProfileName]\n"
"\t[--mergedconfig]\n" "\t[--mergedconfig]\n"
"\t[--validate]\n" "\t[--validate]\n"
"\t[--withsummary]\n"
"\t[--withcomments]\n" "\t[--withcomments]\n"
"\t[--withfullcomments]\n"
"\t[--unconfigured]\n" "\t[--unconfigured]\n"
"\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, ignorelocal_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, withsummary_ARG, withcomments_ARG, unconfigured_ARG, withversions_ARG)
xx(lvmdiskscan, xx(lvmdiskscan,
"List devices that may be used as physical volumes", "List devices that may be used as physical volumes",

View File

@ -220,10 +220,10 @@ int dumpconfig(struct cmd_context *cmd, int argc, char **argv)
goto out; goto out;
} }
if (arg_count(cmd, withsummary_ARG))
tree_spec.withsummary = 1;
if (arg_count(cmd, withcomments_ARG)) if (arg_count(cmd, withcomments_ARG))
tree_spec.withcomments = 1; tree_spec.withcomments = 1;
if (arg_count(cmd, withfullcomments_ARG))
tree_spec.withfullcomments = 1;
if (arg_count(cmd, unconfigured_ARG)) if (arg_count(cmd, unconfigured_ARG))
tree_spec.unconfigured = 1; tree_spec.unconfigured = 1;