summaryrefslogtreecommitdiff
path: root/tools/vgcreate.c
diff options
context:
space:
mode:
authorAlasdair Kergon <agk@redhat.com>2010-11-11 17:29:05 +0000
committerAlasdair Kergon <agk@redhat.com>2010-11-11 17:29:05 +0000
commitf8452d8cfd4711aa9a988254dcd9421d7538710b (patch)
tree74f7ccc3b9a37bf795370af3ce3b0e24a80f186d /tools/vgcreate.c
parent64dff85ce47bd431422022e9afe1a29ead2dc385 (diff)
downloadlvm2-f8452d8cfd4711aa9a988254dcd9421d7538710b.tar.gz
Support repetition of --addtag and --deltag arguments.
Add infrastructure for specific cmdline arguments to be repeated in groups. Split the_args cmdline arguments and values into arg_props and arg_values.
Diffstat (limited to 'tools/vgcreate.c')
-rw-r--r--tools/vgcreate.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/tools/vgcreate.c b/tools/vgcreate.c
index e6f3a2638..3c4c6d2d4 100644
--- a/tools/vgcreate.c
+++ b/tools/vgcreate.c
@@ -24,6 +24,7 @@ int vgcreate(struct cmd_context *cmd, int argc, char **argv)
const char *clustered_message = "";
char *vg_name;
struct pvcreate_params pp;
+ struct arg_value_group_list *current_group;
if (!argc) {
log_error("Please provide volume group name and "
@@ -85,21 +86,24 @@ int vgcreate(struct cmd_context *cmd, int argc, char **argv)
"(0 means unlimited)", vg->max_pv);
if (arg_count(cmd, addtag_ARG)) {
- if (!(tag = arg_str_value(cmd, addtag_ARG, NULL))) {
- log_error("Failed to get tag");
- goto bad;
- }
+ dm_list_iterate_items(current_group, &cmd->arg_value_groups) {
+ if (!grouped_arg_is_set(current_group->arg_values, addtag_ARG))
+ continue;
+
+ if (!(tag = grouped_arg_str_value(current_group->arg_values, addtag_ARG, NULL))) {
+ log_error("Failed to get tag");
+ goto bad;
+ }
- if (!vg_change_tag(vg, tag, 1))
- goto_bad;
+ if (!vg_change_tag(vg, tag, 1))
+ goto_bad;
+ }
}
- if (vg_is_clustered(vg)) {
+ if (vg_is_clustered(vg))
clustered_message = "Clustered ";
- } else {
- if (locking_is_clustered())
- clustered_message = "Non-clustered ";
- }
+ else if (locking_is_clustered())
+ clustered_message = "Non-clustered ";
if (!archive(vg))
goto_bad;