public inbox for lvm2-cvs@sourceware.org
help / color / mirror / Atom feed
* LVM2 ./WHATS_NEW man/vgchange.8 tools/commands ...
@ 2006-08-16 14:41 agk
  0 siblings, 0 replies; only message in thread
From: agk @ 2006-08-16 14:41 UTC (permalink / raw)
  To: lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	agk@sourceware.org	2006-08-16 14:41:42

Modified files:
	.              : WHATS_NEW 
	man            : vgchange.8 
	tools          : commands.h vgchange.c 

Log message:
	Add --maxphysicalvolumes to vgchange.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.418&r2=1.419
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/man/vgchange.8.diff?cvsroot=lvm2&r1=1.7&r2=1.8
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/commands.h.diff?cvsroot=lvm2&r1=1.85&r2=1.86
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgchange.c.diff?cvsroot=lvm2&r1=1.53&r2=1.54

--- LVM2/WHATS_NEW	2006/08/15 19:13:06	1.418
+++ LVM2/WHATS_NEW	2006/08/16 14:41:41	1.419
@@ -1,5 +1,6 @@
 Version 2.02.09 - 
 ==================================
+  Add --maxphysicalvolumes to vgchange.
 
 Version 2.02.08 - 15th August 2006
 ==================================
--- LVM2/man/vgchange.8	2006/04/06 21:15:14	1.7
+++ LVM2/man/vgchange.8	2006/08/16 14:41:41	1.8
@@ -16,6 +16,8 @@
 .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 @@
 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
--- LVM2/tools/commands.h	2006/08/01 14:56:33	1.85
+++ LVM2/tools/commands.h	2006/08/16 14:41:42	1.86
@@ -607,6 +607,7 @@
    "\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 @@
 
    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)",
--- LVM2/tools/vgchange.c	2006/05/12 19:16:48	1.53
+++ LVM2/tools/vgchange.c	2006/08/16 14:41:42	1.54
@@ -312,7 +312,7 @@
 
 	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 @@
 	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 @@
 	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 @@
 {
 	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;
 	}
 


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2006-08-16 14:41 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-08-16 14:41 LVM2 ./WHATS_NEW man/vgchange.8 tools/commands agk

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).