1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

o Add support for the -s and -c flags to lvcreate.

This commit is contained in:
Joe Thornber 2002-02-18 10:59:51 +00:00
parent e1d93eb457
commit 0eb83127ef
3 changed files with 37 additions and 37 deletions

View File

@ -68,41 +68,28 @@ xx(lvchange,
xx(lvcreate,
"Create a logical volume",
"lvcreate " "\n"
"\t[-A|--autobackup {y|n}] " "\n"
"\t[-C|--contiguous {y|n}] " "\n"
"\t[-d|--debug]" "\n"
"\t[-h|--help] " "\n"
"\t[-i|--stripes Stripes [-I|--stripesize StripeSize]]" "\n"
"\t{-l|--extents LogicalExtentsNumber |" "\n"
"\t -L|--size LogicalVolumeSize[kKmMgGtT]} " "\n"
"\t[-A|--autobackup {y|n}]\n"
"\t[-c|--chunksize]\n"
"\t[-C|--contiguous {y|n}]\n"
"\t[-d|--debug]\n"
"\t[-h|--help]\n"
"\t[-i|--stripes Stripes [-I|--stripesize StripeSize]]\n"
"\t{-l|--extents LogicalExtentsNumber |\n"
"\t -L|--size LogicalVolumeSize[kKmMgGtT]}\n"
"\t[-M|--persistent {y|n}] [--minor minor]\n"
"\t[-n|--name LogicalVolumeName]" "\n"
"\t[-p|--permission {r|rw}] " "\n"
"\t[-r|--readahead ReadAheadSectors]" "\n"
"\t[-t|--test] " "\n"
"\t[-v|--verbose] " "\n"
"\t[-Z|--zero {y|n}] " "\n"
"\t[--version]" "\n"
"\tVolumeGroupName [PhysicalVolumePath...]" "\n\n"
"\t[-n|--name LogicalVolumeName]\n"
"\t[-p|--permission {r|rw}]\n"
"\t[-r|--readahead ReadAheadSectors]\n"
"\t[-s|--snapshot]\n"
"\t[-t|--test]\n"
"\t[-v|--verbose]\n"
"\t[-Z|--zero {y|n}]\n"
"\t[--version]\n"
"\tVolumeGroupName [PhysicalVolumePath...]\n\n",
,
/*
"lvcreate "
"\t-s|--snapshot "
"\t[-c|--chunksize ChunkSize]" "\n"
"\t{-l|--extents LogicalExtentsNumber |" "\n"
"\t -L|--size LogicalVolumeSize[kKmMgGtT]}" "\n"
"\t-n|--name SnapshotLogicalVolumeName" "\n"
"\t[-t|--test]" "\n"
"\tLogicalVolume[Path] [PhysicalVolumePath...]" "\n",
chunksize_ARG,
snapshot_ARG,
*/
autobackup_ARG, contiguous_ARG, stripes_ARG, stripesize_ARG,
extents_ARG, size_ARG, name_ARG, permission_ARG, readahead_ARG,
minor_ARG, persistent_ARG,
test_ARG, zero_ARG)
autobackup_ARG, contiguous_ARG, extents_ARG, minor_ARG, name_ARG,
permission_ARG, persistent_ARG, readahead_ARG, size_ARG,
snapshot_ARG, stripes_ARG, stripesize_ARG, test_ARG, zero_ARG)
xx(lvdisplay,
"Display information about a logical volume",

View File

@ -62,6 +62,10 @@ static int _read_name_params(struct lvcreate_params *lp,
return 0;
}
/* Strip the volume group from the origin */
if ((ptr = strrchr(lp->origin, (int) '/')))
lp->origin = ptr + 1;
} else {
/*
* If VG not on command line, try -n arg and then
@ -130,7 +134,7 @@ static int _read_size_params(struct lvcreate_params *lp,
/* Size returned in kilobyte units; held in sectors */
if (arg_count(cmd, size_ARG))
lp->size = arg_int_value(cmd, size_ARG, 0);
lp->size = arg_int64_value(cmd, size_ARG, 0) * 2ull;
return 1;
}
@ -251,7 +255,7 @@ static int _lvcreate(struct cmd_context *cmd, struct lvcreate_params *lp,
uint32_t size_rest;
uint32_t status;
struct volume_group *vg;
struct logical_volume *lv;
struct logical_volume *lv, *org;
struct list *pvh;
@ -312,7 +316,7 @@ static int _lvcreate(struct cmd_context *cmd, struct lvcreate_params *lp,
if (lp->size) {
/* No of 512-byte sectors */
lp->extents = lp->size * 2;
lp->extents = lp->size;
if (lp->extents % vg->extent_size) {
char *s1;
@ -336,6 +340,11 @@ static int _lvcreate(struct cmd_context *cmd, struct lvcreate_params *lp,
lp->extents = lp->extents - size_rest + lp->stripes;
}
if (lp->snapshot && !(org = find_lv(vg, lp->origin))) {
log_err("Couldn't find origin volume '%s'.", lp->origin);
return 0;
}
if (!archive(vg))
return 0;
@ -344,6 +353,11 @@ static int _lvcreate(struct cmd_context *cmd, struct lvcreate_params *lp,
vg, pvh)))
return 0;
if (lp->snapshot && !vg_add_snapshot(vg, org, lv, 1, lp->chunk_size)) {
log_err("Couldn't create snapshot.");
return 0;
}
if (lp->read_ahead) {
log_verbose("Setting read ahead sectors");
lv->read_ahead = lp->read_ahead;

View File

@ -262,7 +262,6 @@ int size_arg(struct arg *a)
a->i64_value = (uint64_t) v;
return 1;
}
int int_arg(struct arg *a)