summaryrefslogtreecommitdiffstats
path: root/tools/pvcreate.c
diff options
context:
space:
mode:
authorAlasdair Kergon <agk@redhat.com>2002-01-16 18:10:08 +0000
committerAlasdair Kergon <agk@redhat.com>2002-01-16 18:10:08 +0000
commitadd7dc2d5a7fb3f59d7635f4addde056cf9256ea (patch)
treee921a5d33b8576ec69e0e47a3dd7494e3cffb8df /tools/pvcreate.c
parentd2b0e8b1c3438b91af4566fb4ce76e5e19791509 (diff)
downloadlvm2-add7dc2d5a7fb3f59d7635f4addde056cf9256ea.tar.gz
lvm2-add7dc2d5a7fb3f59d7635f4addde056cf9256ea.tar.xz
lvm2-add7dc2d5a7fb3f59d7635f4addde056cf9256ea.zip
o pvcreate --uuid to specify the uuid (required before using vgcfgrestore
onto a new device). uuid specified must not already exist on the system. o More message tidying. o When checking for label, only read PV metadata. o Add ataraid. [Needs moving into config/defaults files.]
Diffstat (limited to 'tools/pvcreate.c')
-rw-r--r--tools/pvcreate.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/tools/pvcreate.c b/tools/pvcreate.c
index 3caa2594..e8c668d6 100644
--- a/tools/pvcreate.c
+++ b/tools/pvcreate.c
@@ -77,11 +77,26 @@ static int pvcreate_check(const char *name)
static void pvcreate_single(const char *pv_name)
{
struct physical_volume *pv;
+ struct id id, *idp = NULL;
+ char *uuid;
+ struct device *dev;
+
+ if (arg_count(uuidstr_ARG)) {
+ uuid = arg_str_value(uuidstr_ARG,"");
+ if (!id_read_format(&id, uuid))
+ return;
+ if ((dev = uuid_map_lookup(the_um, &id))) {
+ log_error("uuid %s already in use on %s", uuid,
+ dev_name(dev));
+ return;
+ }
+ idp = &id;
+ }
if (!pvcreate_check(pv_name))
return;
- if (!(pv = pv_create(fid, pv_name))) {
+ if (!(pv = pv_create(fid, pv_name, idp))) {
log_err("Failed to setup physical volume %s", pv_name);
return;
}
@@ -107,6 +122,11 @@ int pvcreate(int argc, char **argv)
return EINVALID_CMD_LINE;
}
+ if (arg_count(uuidstr_ARG) && argc != 1) {
+ log_error("Can only set uuid on one volume at once");
+ return EINVALID_CMD_LINE;
+ }
+
if (arg_count(yes_ARG) && !arg_count(force_ARG)) {
log_error("Option y can only be given with option f");
return EINVALID_CMD_LINE;