]> sourceware.org Git - lvm2.git/commitdiff
dumpconfig: add --ignoreadvanced and --ignoreunsupported switch
authorPeter Rajnoha <prajnoha@redhat.com>
Wed, 6 Mar 2013 08:35:33 +0000 (09:35 +0100)
committerPeter Rajnoha <prajnoha@redhat.com>
Wed, 6 Mar 2013 09:46:36 +0000 (10:46 +0100)
lvm dumpconfig [--ignoreadvanced] [--ignoreunsupported]

--ignoreadvanced causes the advanced configuration options to be left
out on dumpconfig output

--ignoreunsupported causes the options that are not officially supported
to be lef out on dumpconfig output

lib/config/config.c
tools/args.h
tools/commands.h
tools/dumpconfig.c

index 1960b0086b146fd34e01c51dfb5202069767b67b..009eb5f885b61b7b90114c5a012b6f80d4ad3c33 100644 (file)
@@ -1080,7 +1080,9 @@ static struct dm_config_node *_add_def_node(struct dm_config_tree *cft,
 
 static int _should_skip_def_node(struct config_def_tree_spec *spec, int section_id, cfg_def_item_t *def)
 {
-       if (def->parent != section_id)
+       if ((def->parent != section_id) ||
+           (spec->ignoreadvanced && def->flags & CFG_ADVANCED) ||
+           (spec->ignoreunsupported && def->flags & CFG_UNSUPPORTED))
                return 1;
 
        switch (spec->type) {
index 1e850964e857a520d867abbb1358d3900a037330..49ddcd25d0354db45e226a620209f72a870adbe4 100644 (file)
@@ -82,6 +82,8 @@ arg(thinpool_ARG, '\0', "thinpool", string_arg, 0)
 arg(configtype_ARG, '\0', "type", string_arg, 0)
 arg(withcomments_ARG, '\0', "withcomments", NULL, 0)
 arg(withversions_ARG, '\0', "withversions", NULL, 0)
+arg(ignoreadvanced_ARG, '\0', "ignoreadvanced", NULL, 0)
+arg(ignoreunsupported_ARG, '\0', "ignoreunsupported", NULL, 0)
 arg(atversion_ARG, '\0', "atversion", string_arg, 0)
 arg(validate_ARG, '\0', "validate", NULL, 0)
 
index 36928c046116ad966428e6c994622e682b2eca18..9aed9e7eb8f7cc76f56a4ea928862a6bd3b1d667 100644 (file)
@@ -36,11 +36,14 @@ xx(dumpconfig,
    "\t[--type {current|default|missing|new} \n"
    "\t[--withcomments] \n"
    "\t[--withversions] \n"
+   "\t[--ignoreadvanced] \n"
+   "\t[--ignoreunsupported] \n"
    "\t[--atversion version]] \n"
    "\t[--validate]\n"
    "\t[ConfigurationNode...]\n",
    file_ARG, configtype_ARG, withcomments_ARG, atversion_ARG,
-   withversions_ARG, validate_ARG)
+   withversions_ARG, ignoreadvanced_ARG, ignoreunsupported_ARG,
+   validate_ARG)
 
 xx(formats,
    "List available metadata formats",
index 384f52df1a72a97d89735d132638d2ac32ddc46a..a340eb071fb4df9534c55369d5a27de70413aadd 100644 (file)
@@ -50,6 +50,12 @@ int dumpconfig(struct cmd_context *cmd, int argc, char **argv)
                return EINVALID_CMD_LINE;
        }
 
+       if (arg_count(cmd, ignoreadvanced_ARG))
+               tree_spec.ignoreadvanced = 1;
+
+       if (arg_count(cmd, ignoreunsupported_ARG))
+               tree_spec.ignoreunsupported = 1;
+
        if (arg_count(cmd, validate_ARG)) {
                if (config_def_check(cmd, 1, 1, 0)) {
                        log_print("LVM configuration valid.");
@@ -82,6 +88,12 @@ int dumpconfig(struct cmd_context *cmd, int argc, char **argv)
                return EINVALID_CMD_LINE;
        }
 
+       if ((tree_spec.ignoreadvanced || tree_spec.ignoreunsupported) &&
+           (tree_spec.type == CFG_DEF_TREE_CURRENT)) {
+               log_error("--ignoreadvanced and --ignoreunsupported has no effect with --type current");
+               return EINVALID_CMD_LINE;
+       }
+
        if (tree_spec.type != CFG_DEF_TREE_CURRENT) {
                if (!_get_vsn(cmd, &major, &minor, &patchlevel))
                        return EINVALID_CMD_LINE;
This page took 0.040195 seconds and 5 git commands to generate.