arg(pvmetadatacopies_ARG, '\0', "pvmetadatacopies", int_arg, 0)
arg(metadatacopies_ARG, '\0', "metadatacopies", int_arg, 0)
arg(metadatasize_ARG, '\0', "metadatasize", size_mb_arg, 0)
+arg(metadataignore_ARG, '\0', "metadataignore", yes_no_arg, 0)
arg(restorefile_ARG, '\0', "restorefile", string_arg, 0)
arg(labelsector_ARG, '\0', "labelsector", int_arg, 0)
arg(driverloaded_ARG, '\0', "driverloaded", yes_no_arg, 0)
"\t[-t|--test]\n"
"\t[-u|--uuid]\n"
"\t[-x|--allocatable y|n]\n"
+ "\t[--metadataignore y|n]\n"
"\t[-v|--verbose]\n"
"\t[--addtag Tag]\n"
"\t[--deltag Tag]\n"
"\t[PhysicalVolumePath...]\n",
all_ARG, allocatable_ARG, allocation_ARG, autobackup_ARG, deltag_ARG,
- addtag_ARG, test_ARG, uuid_ARG)
+ addtag_ARG, metadataignore_ARG, test_ARG, uuid_ARG)
xx(pvresize,
"Resize physical volume(s)",
int allocatable = 0;
int tagarg = 0;
int r = 0;
+ int mda_ignore = 0;
if (arg_count(cmd, addtag_ARG))
tagarg = addtag_ARG;
if (arg_count(cmd, allocatable_ARG))
allocatable = !strcmp(arg_str_value(cmd, allocatable_ARG, "n"),
"y");
+ if (arg_count(cmd, metadataignore_ARG))
+ mda_ignore = !strcmp(arg_str_value(cmd, metadataignore_ARG, "n"),
+ "y");
else if (tagarg && !(tag = arg_str_value(cmd, tagarg, NULL))) {
log_error("Failed to get tag");
return 0;
goto out;
}
}
+ } else if (arg_count(cmd, metadataignore_ARG)) {
+ if (mda_ignore && (pv_mda_used_count(pv) == 0)) {
+ log_error("Physical volume \"%s\" metadata already "
+ "ignored", pv_name);
+ goto out;
+ }
+ if (!mda_ignore && (pv_mda_used_count(pv) == pv_mda_count(pv))) {
+ log_error("Physical volume \"%s\" metadata already "
+ "not ignored", pv_name);
+ goto out;
+ }
+ if (!pv_mda_count(pv)) {
+ log_error("Physical volume \"%s\" has no metadata "
+ "areas ", pv_name);
+ goto out;
+ }
+ if (mda_ignore) {
+ log_verbose("Setting physical volume \"%s\" "
+ "metadata ignored", pv_name);
+ } else {
+ log_verbose("Setting physical volume \"%s\" "
+ "metadata not ignored", pv_name);
+ }
+ if (!pv_mda_set_ignored(pv, mda_ignore)) {
+ goto out;
+ }
} else {
/* --uuid: Change PV ID randomly */
if (!id_create(&pv->id)) {
struct str_list *sll;
if (arg_count(cmd, allocatable_ARG) + arg_count(cmd, addtag_ARG) +
- arg_count(cmd, deltag_ARG) + arg_count(cmd, uuid_ARG) != 1) {
+ arg_count(cmd, deltag_ARG) + arg_count(cmd, uuid_ARG) +
+ arg_count(cmd, metadataignore_ARG) != 1) {
log_error("Please give exactly one option of -x, -uuid, "
"--addtag or --deltag");
return EINVALID_CMD_LINE;