mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
Add --maxphysicalvolumes to vgchange.
This commit is contained in:
parent
64c8457976
commit
e95d828454
@ -1,5 +1,6 @@
|
||||
Version 2.02.09 -
|
||||
==================================
|
||||
Add --maxphysicalvolumes to vgchange.
|
||||
|
||||
Version 2.02.08 - 15th August 2006
|
||||
==================================
|
||||
|
@ -16,6 +16,8 @@ vgchange \- change attributes of a volume group
|
||||
.RB [ \-\-ignorelockingfailure]
|
||||
.RB [ \-l | \-\-logicalvolume
|
||||
.IR MaxLogicalVolumes ]
|
||||
.RB [ -p | \-\-maxphysicalvolumes
|
||||
.IR MaxPhysicalVolumes ]
|
||||
.RB [ \-P | \-\-partial]
|
||||
.RB [ \-s | \-\-physicalextentsize
|
||||
.IR PhysicalExtentSize [ \fBkKmMgGtT\fR ]]
|
||||
@ -61,6 +63,18 @@ exclusively because they can only be used on one node at once.
|
||||
Changes the maximum logical volume number of an existing inactive
|
||||
volume group.
|
||||
.TP
|
||||
.BR \-p ", " \-\-maxphysicalvolumes " " \fIMaxPhysicalVolumes\fR
|
||||
Changes the maximum number of physical volumes that can belong
|
||||
to this volume group.
|
||||
For volume groups with metadata in lvm1 format, the limit is 255.
|
||||
If the metadata uses lvm2 format, the value 0
|
||||
removes this restriction: there is then no limit.
|
||||
If you have a large number of physical volumes in
|
||||
a volume group with metadata in lvm2 format,
|
||||
for tool performance reasons, you should consider
|
||||
some use of \fB--metadatacopies 0\fP
|
||||
as described in \fBpvcreate(8)\fP.
|
||||
.TP
|
||||
.BR \-s ", " \-\-physicalextentsize " " \fIPhysicalExtentSize\fR[\fBkKmMgGtT\fR]
|
||||
Changes the physical extent size on physical volumes of this volume group.
|
||||
A size suffix (k for kilobytes up to t for terabytes) is optional, megabytes
|
||||
|
@ -607,6 +607,7 @@ xx(vgchange,
|
||||
"\t -c|--clustered {y|n} |" "\n"
|
||||
"\t -x|--resizeable {y|n} |" "\n"
|
||||
"\t -l|--logicalvolume MaxLogicalVolumes |" "\n"
|
||||
"\t -p|--maxphysicalvolumes MaxPhysicalVolumes |" "\n"
|
||||
"\t -s|--physicalextentsize PhysicalExtentSize[kKmMgGtT] |" "\n"
|
||||
"\t --addtag Tag |\n"
|
||||
"\t --deltag Tag}\n"
|
||||
@ -614,8 +615,8 @@ xx(vgchange,
|
||||
|
||||
addtag_ARG, alloc_ARG, allocation_ARG, autobackup_ARG, available_ARG,
|
||||
clustered_ARG, deltag_ARG, ignorelockingfailure_ARG, logicalvolume_ARG,
|
||||
monitor_ARG, partial_ARG, physicalextentsize_ARG, resizeable_ARG,
|
||||
resizable_ARG, test_ARG, uuid_ARG)
|
||||
maxphysicalvolumes_ARG, monitor_ARG, partial_ARG, physicalextentsize_ARG,
|
||||
resizeable_ARG, resizable_ARG, test_ARG, uuid_ARG)
|
||||
|
||||
xx(vgck,
|
||||
"Check the consistency of volume group(s)",
|
||||
|
@ -312,7 +312,7 @@ static int _vgchange_logicalvolume(struct cmd_context *cmd,
|
||||
|
||||
if (max_lv && max_lv < vg->lv_count) {
|
||||
log_error("MaxLogicalVolume is less than the current number "
|
||||
"%d of logical volume(s) for \"%s\"", vg->lv_count,
|
||||
"%d of LVs for \"%s\"", vg->lv_count,
|
||||
vg->name);
|
||||
return ECMD_FAILED;
|
||||
}
|
||||
@ -332,6 +332,53 @@ static int _vgchange_logicalvolume(struct cmd_context *cmd,
|
||||
return ECMD_PROCESSED;
|
||||
}
|
||||
|
||||
static int _vgchange_physicalvolumes(struct cmd_context *cmd,
|
||||
struct volume_group *vg)
|
||||
{
|
||||
uint32_t max_pv = arg_uint_value(cmd, maxphysicalvolumes_ARG, 0);
|
||||
|
||||
if (!(vg->status & RESIZEABLE_VG)) {
|
||||
log_error("Volume group \"%s\" must be resizeable "
|
||||
"to change MaxPhysicalVolumes", vg->name);
|
||||
return ECMD_FAILED;
|
||||
}
|
||||
|
||||
if (arg_sign_value(cmd, maxphysicalvolumes_ARG, 0) == SIGN_MINUS) {
|
||||
log_error("MaxPhysicalVolumes may not be negative");
|
||||
return EINVALID_CMD_LINE;
|
||||
}
|
||||
|
||||
if (!(vg->fid->fmt->features & FMT_UNLIMITED_VOLS)) {
|
||||
if (!max_pv)
|
||||
max_pv = 255;
|
||||
else if (max_pv > 255) {
|
||||
log_error("MaxPhysicalVolume limit is 255");
|
||||
return ECMD_FAILED;
|
||||
}
|
||||
}
|
||||
|
||||
if (max_pv && max_pv < vg->pv_count) {
|
||||
log_error("MaxPhysicalVolumes is less than the current number "
|
||||
"%d of PVs for \"%s\"", vg->pv_count,
|
||||
vg->name);
|
||||
return ECMD_FAILED;
|
||||
}
|
||||
|
||||
if (!archive(vg))
|
||||
return ECMD_FAILED;
|
||||
|
||||
vg->max_pv = max_pv;
|
||||
|
||||
if (!vg_write(vg) || !vg_commit(vg))
|
||||
return ECMD_FAILED;
|
||||
|
||||
backup(vg);
|
||||
|
||||
log_print("Volume group \"%s\" successfully changed", vg->name);
|
||||
|
||||
return ECMD_PROCESSED;
|
||||
}
|
||||
|
||||
static int _vgchange_pesize(struct cmd_context *cmd, struct volume_group *vg)
|
||||
{
|
||||
uint32_t extent_size;
|
||||
@ -508,6 +555,9 @@ static int vgchange_single(struct cmd_context *cmd, const char *vg_name,
|
||||
else if (arg_count(cmd, logicalvolume_ARG))
|
||||
r = _vgchange_logicalvolume(cmd, vg);
|
||||
|
||||
else if (arg_count(cmd, maxphysicalvolumes_ARG))
|
||||
r = _vgchange_physicalvolumes(cmd, vg);
|
||||
|
||||
else if (arg_count(cmd, addtag_ARG))
|
||||
r = _vgchange_tag(cmd, vg, addtag_ARG);
|
||||
|
||||
@ -533,24 +583,26 @@ int vgchange(struct cmd_context *cmd, int argc, char **argv)
|
||||
{
|
||||
if (!
|
||||
(arg_count(cmd, available_ARG) + arg_count(cmd, logicalvolume_ARG) +
|
||||
arg_count(cmd, maxphysicalvolumes_ARG) +
|
||||
arg_count(cmd, resizeable_ARG) + arg_count(cmd, deltag_ARG) +
|
||||
arg_count(cmd, addtag_ARG) + arg_count(cmd, uuid_ARG) +
|
||||
arg_count(cmd, physicalextentsize_ARG) +
|
||||
arg_count(cmd, clustered_ARG) + arg_count(cmd, alloc_ARG) +
|
||||
arg_count(cmd, monitor_ARG))) {
|
||||
log_error("One of -a, -c, -l, -s, -x, --uuid, --alloc, --addtag or "
|
||||
"--deltag required");
|
||||
log_error("One of -a, -c, -l, -p, -s, -x, --uuid, --alloc, "
|
||||
"--addtag or --deltag required");
|
||||
return EINVALID_CMD_LINE;
|
||||
}
|
||||
|
||||
/* FIXME Cope with several changes at once! */
|
||||
if (arg_count(cmd, available_ARG) + arg_count(cmd, logicalvolume_ARG) +
|
||||
arg_count(cmd, maxphysicalvolumes_ARG) +
|
||||
arg_count(cmd, resizeable_ARG) + arg_count(cmd, deltag_ARG) +
|
||||
arg_count(cmd, addtag_ARG) + arg_count(cmd, alloc_ARG) +
|
||||
arg_count(cmd, uuid_ARG) + arg_count(cmd, clustered_ARG) +
|
||||
arg_count(cmd, physicalextentsize_ARG) > 1) {
|
||||
log_error("Only one of -a, -c, -l, -s, -x, --uuid, --alloc, "
|
||||
"--addtag or --deltag allowed");
|
||||
log_error("Only one of -a, -c, -l, -p, -s, -x, --uuid, "
|
||||
"--alloc, --addtag or --deltag allowed");
|
||||
return EINVALID_CMD_LINE;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user