summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorMike Snitzer <snitzer@redhat.com>2010-08-12 04:08:59 +0000
committerMike Snitzer <snitzer@redhat.com>2010-08-12 04:08:59 +0000
commitdff224669d075625d4d5210c9808b6c22a4830ba (patch)
tree5ef1670e7f78df2afe400d526a2dc840ffdd1a3f /tools
parentdc39d2a66e4dfaa9fd1d751eb5b1d3e532cfcc16 (diff)
downloadlvm2-dff224669d075625d4d5210c9808b6c22a4830ba.tar.gz
lvm2-dff224669d075625d4d5210c9808b6c22a4830ba.tar.xz
lvm2-dff224669d075625d4d5210c9808b6c22a4830ba.zip
Require --restorefile when using pvcreate --uuid.
Introduce --norestorefile to allow user to override the new requirement. This can also be overridden with "devices/require_restorefile_with_uuid" in lvm.conf -- however the default is 1. Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/args.h1
-rw-r--r--tools/commands.h6
-rw-r--r--tools/pvcreate.c10
3 files changed, 15 insertions, 2 deletions
diff --git a/tools/args.h b/tools/args.h
index a23c46cb..91d7b095 100644
--- a/tools/args.h
+++ b/tools/args.h
@@ -27,6 +27,7 @@ arg(vgmetadatacopies_ARG, '\0', "vgmetadatacopies", metadatacopies_arg, 0)
arg(metadatacopies_ARG, '\0', "metadatacopies", metadatacopies_arg, 0)
arg(metadatasize_ARG, '\0', "metadatasize", size_mb_arg, 0)
arg(metadataignore_ARG, '\0', "metadataignore", yes_no_arg, 0)
+arg(norestorefile_ARG, '\0', "norestorefile", NULL, 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)
diff --git a/tools/commands.h b/tools/commands.h
index d9e13f42..1c113201 100644
--- a/tools/commands.h
+++ b/tools/commands.h
@@ -497,6 +497,7 @@ xx(pvcreate,
"Initialize physical volume(s) for use by LVM",
0,
"pvcreate " "\n"
+ "\t[--norestorefile]\n"
"\t[--restorefile file]\n"
"\t[-d|--debug]" "\n"
"\t[-f[f]|--force [--force]] " "\n"
@@ -517,8 +518,9 @@ xx(pvcreate,
"\tPhysicalVolume [PhysicalVolume...]\n",
dataalignment_ARG, dataalignmentoffset_ARG, force_ARG, test_ARG,
- labelsector_ARG, metadatatype_ARG, metadatacopies_ARG, pvmetadatacopies_ARG,
- metadatasize_ARG, metadataignore_ARG, physicalvolumesize_ARG,
+ labelsector_ARG, metadatatype_ARG, metadatacopies_ARG,
+ metadatasize_ARG, metadataignore_ARG, norestorefile_ARG,
+ physicalvolumesize_ARG, pvmetadatacopies_ARG,
restorefile_ARG, uuidstr_ARG, yes_ARG, zero_ARG)
xx(pvdata,
diff --git a/tools/pvcreate.c b/tools/pvcreate.c
index df7664b5..23ff02fa 100644
--- a/tools/pvcreate.c
+++ b/tools/pvcreate.c
@@ -36,6 +36,16 @@ static int pvcreate_restore_params_validate(struct cmd_context *cmd,
return 0;
}
+ if (!arg_count(cmd, restorefile_ARG) && arg_count(cmd, uuidstr_ARG)) {
+ if (!arg_count(cmd, norestorefile_ARG) &&
+ find_config_tree_bool(cmd,
+ "devices/require_restorefile_with_uuid",
+ DEFAULT_REQUIRE_RESTOREFILE_WITH_UUID)) {
+ log_error("--restorefile is required with --uuid");
+ return 0;
+ }
+ }
+
if (arg_count(cmd, uuidstr_ARG) && argc != 1) {
log_error("Can only set uuid on one volume at once");
return 0;