]> sourceware.org Git - lvm2.git/commitdiff
Add --vgmetadatacopies to vgcreate man page, command, and lvm.conf.
authorDave Wysochanski <dwysocha@redhat.com>
Mon, 28 Jun 2010 20:38:23 +0000 (20:38 +0000)
committerDave Wysochanski <dwysocha@redhat.com>
Mon, 28 Jun 2010 20:38:23 +0000 (20:38 +0000)
Allow parsing of --vgmetadatacopies for vgcreate.  Accept
--metadatacopies as a synonym for --vgmetadatacopies.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
man/lvm.conf.5.in
man/vgcreate.8.in
tools/commands.h
tools/toollib.c
tools/vgcreate.c

index 02ebb2a09e462126b7243715d1dac5e6057a1f86..88f3ab35263f11605d3e1afa40db980d46b41ec5 100644 (file)
@@ -386,7 +386,7 @@ to store on each physical volume.
 Currently it can be set to 0, 1 or 2.  The default is 1.  
 If set to 2, one copy is placed at the beginning of the disk
 and the other is placed at the end.
-It can be overridden on the command line with \fB--metadatacopies\fP.
+It can be overridden on the command line with \fB--pvmetadatacopies\fP.
 If creating a volume group with just one physical volume, it's a
 good idea to have 2 copies.  If creating a large volume group with
 many physical volumes, you may decide that 3 copies of the metadata
@@ -406,6 +406,26 @@ The metadata areas are treated as circular buffers, so
 unused space becomes filled with an archive of the most recent
 previous versions of the metadata.
 .IP
+\fBvgmetadatacopies\fP \(em When creating a volume group using the
+LVM2 metadata format, this is the default number of copies of metadata
+desired across all the physical volumes in the volume group.  If set to
+a non-zero value, LVM will automatically set or clear the metadataignore
+flag on the physical volumes (see \fBpvchange --metadataignore\fP) in order
+to achieve the desired number of metadata copies.  An LVM command that
+adds or removes physical volumes (for example, \fBvgextend\fP, \fBvgreduce\fP,
+\fBvgsplit\fP, or \fBvgmerge\fP), may cause LVM to automatically set or
+clear the metadataignore flags.  Also, if physical volumes go missing or
+reappear, or a new number of copies is explicitly set (see
+\fBvgchange --vgmetadatacopies\fP), LVM may adjust the metadataignore flags.
+Set \fBvgmetadatacopies\fP to 0 instructs LVM not to set or clear the
+metadataignore flags automatically.  You may set a value larger than the
+sum of all metadata areas on all physical volumes.  The value can
+be overridden on the command line with \fB--vgmetadatacopies\fP for various
+commands (for example, \fBvgcreate\fP and \fBvgchange\fP), and can be
+queryied with the \fBvg_mda_copies\fP field of \fBvgs\fP.  This option
+is useful for volume groups containing large numbers of physical volumes
+with metadata as it may be used to minimize metadata read and write overhead.
+.IP
 \fBdirs\fP \(em List of directories holding live copies of LVM2
 metadata as text files.  These directories must not be on logical
 volumes.  It is possible to use LVM2 with a couple of directories
index 06e00069384a9e2b685a59e02f127cb4b8ae71a9..e3d970e3976d07e3d2b065cf92e91355626495d8 100644 (file)
@@ -16,6 +16,8 @@ vgcreate \- create a volume group
 .RB [ -M | \-\-metadatatype type]
 .RB [ -p | \-\-maxphysicalvolumes
 .IR MaxPhysicalVolumes ]
+.RB [ \-\-[vg]metadatacopies ]
+.IR NumberOfCopies|unmanaged|all ]
 .RB [ \-s | \-\-physicalextentsize
 .IR PhysicalExtentSize [ \fBbBsSkKmMgGtTpPeE\fR ]]
 .RB [ \-t | \-\-test ]
@@ -66,13 +68,24 @@ to this volume group.
 The setting can be changed with \fBvgchange\fP.
 For volume groups with metadata in lvm1 format, the limit
 and default value is 255.  
-If the metadata uses lvm2 format, the default value is 0
-which 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--pvmetadatacopies 0\fP
-as described in \fBpvcreate(8)\fP.
+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--pvmetadatacopies 0\fP as described in
+\fBpvcreate(8)\fP, and/or use \fB--vgmetadatacopies\fP.
+.TP
+.BR \-\-vgmetadatacopies " " \fINumberOfCopies|unmanaged|all\fP
+Sets the desired number of metadata copies in the volume group.  If set to
+a non-zero value, LVM will automatically manage the 'metadataignore'
+flags on the physical volumes (see \fBpvchange --metadataignore\fP) in order
+to achieve \fINumberOfCopies\fP copies of metadata.  If set to \fIunmanaged\fP,
+LVM will not automatically manage the 'metadataignore' flags.  If set to
+\fIall\fP, LVM will first clear all of the 'metadataignore' flags on all
+metadata areas in the volume group, then set the value to \fIunmanaged\fP.
+The \fBvgmetadatacopies\fP option is useful for volume groups containing
+large numbers of physical volumes with metadata as it may be used to
+minimize metadata read and write overhead.
+The default value is \fIunmanaged\fP.
 .TP
 .BR \-s ", " \-\-physicalextentsize " " \fIPhysicalExtentSize\fR[\fBbBsSkKmMgGtTpPeE\fR]
 Sets the physical extent size on physical volumes of this volume group.
index 62a684be7f8061da96b70038156423c124c6182a..8f5ff3a94e89b88c93f239b50b6e7b09ccf466dd 100644 (file)
@@ -776,6 +776,7 @@ xx(vgcreate,
    "\t[-h|--help]" "\n"
    "\t[-l|--maxlogicalvolumes MaxLogicalVolumes]" "\n"
    "\t[-M|--metadatatype 1|2] " "\n"
+   "\t[--[vg]metadatacopies #copies] " "\n"
    "\t[-p|--maxphysicalvolumes MaxPhysicalVolumes] " "\n"
    "\t[-s|--physicalextentsize PhysicalExtentSize[bBsSkKmMgGtTpPeE]] " "\n"
    "\t[-t|--test] " "\n"
@@ -787,8 +788,8 @@ xx(vgcreate,
    addtag_ARG, alloc_ARG, autobackup_ARG, clustered_ARG, maxlogicalvolumes_ARG,
    maxphysicalvolumes_ARG, metadatatype_ARG, physicalextentsize_ARG, test_ARG,
    force_ARG, yes_ARG, zero_ARG, labelsector_ARG, metadatasize_ARG,
-   pvmetadatacopies_ARG, metadatacopies_ARG, dataalignment_ARG,
-   dataalignmentoffset_ARG)
+   pvmetadatacopies_ARG, metadatacopies_ARG, vgmetadatacopies_ARG,
+   dataalignment_ARG, dataalignmentoffset_ARG)
 
 xx(vgdisplay,
    "Display volume group information",
index 02b06fdc9cba7dcfb05f752e0d0fc6b79f1edf4e..e56a3e583e441af9b172316f7b2d3938f46a7b0c 100644 (file)
@@ -1243,6 +1243,18 @@ int vgcreate_params_set_from_args(struct cmd_context *cmd,
                return 1;
        }
 
+       if (arg_count(cmd, metadatacopies_ARG)) {
+               vp_new->metadata_copies = arg_int_value(cmd, metadatacopies_ARG,
+                                                       DEFAULT_VGMETADATACOPIES);
+       } else if (arg_count(cmd, vgmetadatacopies_ARG)) {
+               vp_new->metadata_copies = arg_int_value(cmd, vgmetadatacopies_ARG,
+                                                       DEFAULT_VGMETADATACOPIES);
+       } else {
+               vp_new->metadata_copies = find_config_tree_int(cmd,
+                                                  "metadata/vgmetadatacopies",
+                                                  DEFAULT_VGMETADATACOPIES);
+       }
+
        return 0;
 }
 
index 60871457e73fab8b636ee9d7173855c477b2a877..3bb500f5dfe8f7b3e0eb6cc6b7ae7a60db59403f 100644 (file)
@@ -35,11 +35,6 @@ int vgcreate(struct cmd_context *cmd, int argc, char **argv)
        argc--;
        argv++;
 
-       if (arg_count(cmd, metadatacopies_ARG)) {
-               log_error("Invalid option --metadatacopies, "
-                         "use --pvmetadatacopies instead.");
-               return EINVALID_CMD_LINE;
-       }
        pvcreate_params_set_defaults(&pp);
        if (!pvcreate_params_validate(cmd, argc, argv, &pp)) {
                return EINVALID_CMD_LINE;
@@ -68,7 +63,8 @@ int vgcreate(struct cmd_context *cmd, int argc, char **argv)
            !vg_set_max_lv(vg, vp_new.max_lv) ||
            !vg_set_max_pv(vg, vp_new.max_pv) ||
            !vg_set_alloc_policy(vg, vp_new.alloc) ||
-           !vg_set_clustered(vg, vp_new.clustered))
+           !vg_set_clustered(vg, vp_new.clustered) ||
+           !vg_set_mda_copies(vg, vp_new.metadata_copies))
                goto bad_orphan;
 
        if (!lock_vol(cmd, VG_ORPHANS, LCK_VG_WRITE)) {
This page took 0.03914 seconds and 5 git commands to generate.