for (i = 0; i < cmd->command->ro_count + cmd->command->any_ro_count; i++) {
opt_enum = cmd->command->required_opt_args[i].opt;
- if (!arg_is_set(cmd, opt_enum))
- continue;
+ if (!arg_is_set(cmd, opt_enum)) {
+ if ((opt_enum != metadataprofile_ARG) ||
+ !arg_is_set(cmd, profile_ARG))
+ continue;
+ }
/*
* Skip options requiring direct commit/reload
return report_headings_str_to_type(av->value) != REPORT_HEADINGS_UNKNOWN;
}
+static int _is_profile_metadataprofile(const char *name)
+{
+ return (!strcmp(name, "lvcreate") ||
+ !strcmp(name, "lvconvert") ||
+ !strcmp(name, "vgcreate") ||
+ !strcmp(name, "lvchange") ||
+ !strcmp(name, "vgchange"));
+}
+
/*
* FIXME: there's been a confusing mixup among:
* resizeable, resizable, allocatable, allocation.
if (!strncmp(cmd_name, "vg", 2))
return metadatacopies_ARG;
return 0;
+ case metadataprofile_ARG:
+ if (_is_profile_metadataprofile(cmd_name))
+ return profile_ARG;
+ return 0;
}
return 0;
}
if (!strncmp(cmd_name, "vg", 2))
return vgmetadatacopies_ARG;
return 0;
+ case profile_ARG:
+ if (_is_profile_metadataprofile(cmd_name))
+ return metadataprofile_ARG;
+ return 0;
}
return 0;
}
* it's recognized as shortcut to --metadataprofile.
* The --commandprofile is assumed otherwise.
*/
- if (!strcmp(cmd->command->name, "lvcreate") ||
- !strcmp(cmd->command->name, "lvconvert") ||
- !strcmp(cmd->command->name, "vgcreate") ||
- !strcmp(cmd->command->name, "lvchange") ||
- !strcmp(cmd->command->name, "vgchange")) {
+ if (_is_profile_metadataprofile(cmd->command->name)) {
if (arg_is_set(cmd, metadataprofile_ARG)) {
log_error("Only one of --profile or "
" --metadataprofile allowed.");