Mirror argument changes.
PATCH 1/1 Mirror argument changes.
Patch name: lvm2-mirror-argument-change.patch
brassow
This patch changes the arguments that specify the mirror log type. Previously, we had a '--corelog' argument that would change the default type from 'disk' to 'core'. I think that creates too much confusion - especially when doing conversions on mirrors.
The new argument '--log' takes either "disk" or "core" as a parameter. This could be expanded in the future for additional logging types as well.
Examples:
# Creating a 2-way mirror
$> lvcreate -m1 ... # implicitly use default disk logging $> lvcreate -m1 --log disk ... # explicit disk logging $> lvcreate -m1 --log core ... # specify core logging $> lvcreate -m1 --corelog ... # old way still works
# Conversion examples
$> lvconvert --log core ... # convert to core logging
$> lvconvert --log disk ... # convert to disk logging
$> lvconvert -mX --corelog ... # old way still works
$> lvconvert -mX ... # old way of converting to disk logging still works
Changes are reflected in the man pages.
[Note: I did not update the WHATS_NEW file.]
tools/args.h +1 -0
@@ -48,6 +48,7 @@ arg(mirrorsonly_ARG, '\0', "mirrorsonly" arg(nosync_ARG, '\0', "nosync", NULL) arg(resync_ARG, '\0', "resync", NULL) arg(corelog_ARG, '\0', "corelog", NULL) +arg(log_ARG, '\0', "log", string_arg) arg(monitor_ARG, '\0', "monitor", yes_no_arg) arg(config_ARG, '\0', "config", string_arg)arg (trustcache_ARG,'\0' ,"trustcache" ,NULL )
tools/commands.h +5 -5
@@ -88,7 +88,7 @@ xx(lvchange,xx (lvconvert,"Change logical volume layout" ,"lvconvert " -"[-m|--mirrors Mirrors [--corelog]]\n" +"[-m|--mirrors Mirrors [--log {disk|core}]]\n" "\t[-R|--regionsize MirrorLogRegionSize]\n" "\t[--alloc AllocationPolicy]\n" "\t[-d|--debug]\n"
@@ -107,8 +107,8 @@ xx(lvconvert, "\t[--version]" "\n" "\tOriginalLogicalVolume[Path] SnapshotLogicalVolume[Path]\n", - alloc_ARG, chunksize_ARG, mirrors_ARG, corelog_ARG, regionsize_ARG, - snapshot_ARG, test_ARG, zero_ARG) + alloc_ARG, chunksize_ARG, mirrors_ARG, corelog_ARG, log_ARG, + regionsize_ARG, snapshot_ARG, test_ARG, zero_ARG) xx(lvcreate, "Create a logical volume",
@@ -123,7 +123,7 @@ xx(lvcreate,"\t{-l|--extents LogicalExtentsNumber |\n" "\t -L|--size LogicalVolumeSize[kKmMgGtTpPeE]}\n" "\t[-M|--persistent {y|n}] [--major major] [--minor minor]\n" -"\t[-m|--mirrors Mirrors [--nosync] [--corelog]]\n" +"\t[-m|--mirrors Mirrors [--nosync] [--log {disk|core}]]\n" "\t[-n|--name LogicalVolumeName]\n" "\t[-p|--permission {r|rw}]\n" "\t[-r|--readahead ReadAheadSectors]\n"
@@ -156,7 +156,7 @@ xx(lvcreate,"\tOriginalLogicalVolume[Path] [PhysicalVolumePath...]\n\n" , addtag_ARG, alloc_ARG, autobackup_ARG, chunksize_ARG, contiguous_ARG, - corelog_ARG, extents_ARG, major_ARG, minor_ARG, mirrors_ARG, name_ARG, + corelog_ARG, log_ARG, extents_ARG, major_ARG, minor_ARG, mirrors_ARG, name_ARG, nosync_ARG, permission_ARG, persistent_ARG, readahead_ARG, regionsize_ARG, size_ARG, snapshot_ARG, stripes_ARG, stripesize_ARG, test_ARG, type_ARG, zero_ARG)
tools/lvcreate.c +20 -1
@@ -241,6 +241,7 @@ static int _read_mirror_params(struct lvint argc = *pargc;int region_size;int pagesize =lvm_getpagesize (); +const char *log_arg;if (argc && (unsigned ) argc < lp->mirrors) { log_error("Too few physical volumes on "
@@ -284,7 +285,25 @@ static int _read_mirror_params(struct lvreturn 0 ; } - lp->corelog =arg_count (cmd, corelog_ARG) ?1 :0 ; +if (arg_count (cmd, corelog_ARG)) { +log_verbose ("Setting logging type to \"core\"" ); + lp->corelog =1 ; + } + +if (arg_count (cmd, log_ARG)) { + log_arg =arg_str_value (cmd, log_ARG,"disk" ); +if (!strcmp ("disk" , log_arg)) { +log_verbose ("Setting logging type to \"disk\"" ); + lp->corelog =0 ; + }else if (!strcmp ("core" , log_arg)) { +log_verbose ("Setting logging type to \"core\"" ); + lp->corelog =1 ; + }else { +log_error ("Unknown logging type, \"%s\"" , log_arg); +return 0 ; + } + } + lp->nosync =arg_count (cmd, nosync_ARG) ?1 :0 ;return 1 ;
man/lvconvert.8 +14 -13
@@ -3,7 +3,7 @@ lvconvert \- convert a logical volume from linear to mirror or snapshot .SH SYNOPSIS .B lvconvert -\-m/\-\-mirrors Mirrors [\-\-corelog] [\-R/\-\-regionsize MirrorLogRegionSize] +\-m/\-\-mirrors Mirrors [\-\-log {disk|core}] [\-R/\-\-regionsize MirrorLogRegionSize] [\-A/\-\-alloc AllocationPolicy] [\-h/\-?/\-\-help] [\-v/\-\-verbose]
@@ -37,12 +37,10 @@ For example, "-m 1" would convert the or volume to a mirror volume with 2-sides; that is, a linear volume plus one copy. .TP -.I \-\-corelog -This optional argument tells lvconvert to switch the -mirror from using a disk-based (persistent) log to -an in-memory log. You may only specify this option -when the \-\-mirror argument is the same degree of -the mirror you are changing. +.I \-\-log disk/core +This optional argument gives the ability to switch the +logging type that is used by a mirror. The logging type +can be either "disk" (persistent) or "core" (non-persistent). .TP .I \-R, \-\-regionsize MirrorLogRegionSize A mirror is divided into regions of this size (in MB), and the mirror log
@@ -64,14 +62,17 @@ If the volume is read-only the snapshot "lvconvert -m1 vg00/lvol1" .br converts the linear logical volume "vg00/lvol1" to -a mirror logical volume. This command could also -be used to convert a two-way mirror with an -in-memory log to a two-way mirror with a disk log. +a two-legged mirror logical volume. -"lvconvert -m1 --corelog vg00/lvol1" +"lvconvert --log core vg00/lvol1" .br -converts a two-way mirror with a disk log to a -two-way mirror with an in-memory log. +converts a mirror with a disk log to a +mirror with an in-memory log. + +"lvconvert --log disk vg00/lvol1" +.br +converts a mirror with an in-memory log +to a mirror with a disk log. "lvconvert -m0 vg00/lvol1" .br
man/lvcreate.8 +12 -6
@@ -11,7 +11,7 @@ lvcreate \- create a logical volume in a {\-l/\-\-extents LogicalExtentsNumber[%{VG|FREE}] | \-L/\-\-size LogicalVolumeSize[kKmMgGtT]} [\-M/\-\-persistent y/n] [\-\-minor minor] -[\-m/\-\-mirrors Mirrors [\-\-nosync] [\-\-corelog] +[\-m/\-\-mirrors Mirrors [\-\-nosync] [\-\-log {disk|log}] [\-R/\-\-regionsize MirrorLogRegionSize]] [\-n/\-\-name LogicalVolumeName] [\-p/\-\-permission r/rw] [\-r/\-\-readahead ReadAheadSectors]
@@ -95,11 +95,13 @@ afterwards will be mirrored, but the ori copied. This is useful for skipping a potentially long and resource intensive initial sync. -Specifying the optional argument "--corelog" will create a mirror with -an in-memory log verses a disk-based (persistent) log. While this -removes the need for an extra log device and *may* be slightly faster, -it requires that the entire mirror be resynchronized upon each -instantiation (e.g. a reboot). +The optional argument "--log" gives the ability to specify the type +of mirror log to be used. The available types are "disk" and "core", +where "disk" is the default. The "disk" log is persistent and requires +a small amount of storage space - usually on a separate device from the +mirror legs. While the "disk" log may cause the mirror to be slightly +slower during writes, it prevents the need to completely resynchronize +the mirror upon each instantiation (e.g. a reboot). .TP .I \-n, \-\-name LogicalVolumeName The name for the new logical volume.
@@ -157,6 +159,10 @@ with 2 sides with a useable size of 500 require 3 devices - two for the mirror devices and one for the disk log. +"lvcreate -m1 --log core -L 500M vg00" tries to create a mirror logical volume +with 2 sides with a useable size of 500 MiB. This operation would +require 2 devices - the log is "in-memory". + "lvcreate --size 100m --snapshot --name snap /dev/vg00/lvol1" .br creates a snapshot logical volume named /dev/vg00/snap which has access to the
tools/lvconvert.c +53 -8
114 lines not on this page · raw message