master - report: identify LV hodling sanlock locks as 'private, lockd, sanlock' within lv_role report field
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=e04424e87e66df...
Commit: e04424e87e66df22578d1e4d2488615cd3692873
Parent: 277dd0aa7a9013697ae99164900d8d8ec12a2850
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Thu Oct 8 13:44:21 2015 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Thu Oct 8 13:44:29 2015 +0200
report: identify LV hodling sanlock locks as 'private,lockd,sanlock' within lv_role report field
Before this patch:
$ lvs -a -o name,layout,role test/lvmlock
LV Layout Role
[lvmlock] linear public
With this patch applied:
$ lvs -a -o name,layout,role test/lvmlock
LV Layout Role
[lvmlock] linear private,lockd,sanlock
---
WHATS_NEW | 1 +
lib/metadata/lv_manip.c | 11 +++++++++++
2 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 5da1552..227530d 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.133 -
======================================
+ Properly identify internal LV holding sanlock locks within lv_role field.
Add metadata_devices and seg_metadata_le_ranges report fields for raid vols.
Fix lvm2-{activation,clvmd,cmirrord,monitor} service to exec before mounting.
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index 48d7d34..3e870d5 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -129,6 +129,8 @@ enum {
LV_TYPE_RAID6_ZR,
LV_TYPE_RAID6_NR,
LV_TYPE_RAID6_NC,
+ LV_TYPE_LOCKD,
+ LV_TYPE_SANLOCK
};
static const char *_lv_type_names[] = {
@@ -173,6 +175,8 @@ static const char *_lv_type_names[] = {
[LV_TYPE_RAID6_ZR] = SEG_TYPE_NAME_RAID6_ZR,
[LV_TYPE_RAID6_NR] = SEG_TYPE_NAME_RAID6_NR,
[LV_TYPE_RAID6_NC] = SEG_TYPE_NAME_RAID6_NC,
+ [LV_TYPE_LOCKD] = "lockd",
+ [LV_TYPE_SANLOCK] = "sanlock",
};
static int _lv_layout_and_role_mirror(struct dm_pool *mem,
@@ -505,6 +509,13 @@ int lv_layout_and_role(struct dm_pool *mem, const struct logical_volume *lv,
if (!_lv_layout_and_role_thick_origin_snapshot(mem, lv, *layout, *role, &public_lv))
goto_bad;
+ if (lv_is_lockd_sanlock_lv(lv)) {
+ if (!str_list_add_no_dup_check(mem, *role, _lv_type_names[LV_TYPE_LOCKD]) ||
+ !str_list_add_no_dup_check(mem, *role, _lv_type_names[LV_TYPE_SANLOCK]))
+ goto_bad;
+ public_lv = 0;
+ }
+
/*
* If layout not yet determined, it must be either
* linear or striped or mixture of these two.
7 years, 5 months
master - tests: check devices with prefix aren't in use
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=277dd0aa7a9013...
Commit: 277dd0aa7a9013697ae99164900d8d8ec12a2850
Parent: ded9452174664b7e204f5ce266bbd5c770714474
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Oct 6 14:55:24 2015 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Oct 6 15:23:55 2015 +0200
tests: check devices with prefix aren't in use
Avoid running tests, when prefix already exist in the system.
As prefix just uses PID number, we may hit a case for long
running tests, where devices from some previous runs were not
properly cleared away - detect this and fail early.
(Such machine should be inspected and fixed).
---
test/lib/inittest.sh | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/test/lib/inittest.sh b/test/lib/inittest.sh
index a5eeb57..4ed8d20 100644
--- a/test/lib/inittest.sh
+++ b/test/lib/inittest.sh
@@ -29,6 +29,9 @@ TESTOLDPWD=$(pwd)
COMMON_PREFIX="LVMTEST"
PREFIX="${COMMON_PREFIX}$$"
+# Check we are not conflickting with some exiting setup
+dmsetup table | not grep "$PREFIX" || die "DM table already has devices with prefix $PREFIX!"
+
if test -z "$LVM_TEST_DIR"; then LVM_TEST_DIR=$TMPDIR; fi
TESTDIR=$(mkdtemp "${LVM_TEST_DIR:-/tmp}" "$PREFIX.XXXXXXXXXX") || \
die "failed to create temporary directory in ${LVM_TEST_DIR:-$TESTOLDPWD}"
7 years, 5 months
master - man: lvcreate continue
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=ded9452174664b...
Commit: ded9452174664b7e204f5ce266bbd5c770714474
Parent: 4b1cadbd87a0814a46b36b07cfe94eda7baacb28
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Oct 6 14:55:09 2015 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Oct 6 15:23:55 2015 +0200
man: lvcreate continue
Finish remaing bits of updating pages for better rendering
with -Thtml, -Tps.
---
man/lvchange.8.in | 3 +
man/lvcreate.8.in | 277 ++++++++++++++++++++++++++++++----------------------
man/lvm.8.in | 1 +
3 files changed, 164 insertions(+), 117 deletions(-)
diff --git a/man/lvchange.8.in b/man/lvchange.8.in
index 62bdca1..8ae17a0 100644
--- a/man/lvchange.8.in
+++ b/man/lvchange.8.in
@@ -431,7 +431,10 @@ Suppress locking failure messages.
Changes the permission on volume lvol1 in volume group vg00 to be read-only:
.sp
.B lvchange \-pr vg00/lvol1
+.
.SH SEE ALSO
+.
+.nh
.BR lvm (8),
.BR lvmetad (8),
.BR lvs (8),
diff --git a/man/lvcreate.8.in b/man/lvcreate.8.in
index 8a364c4..2ce39dd 100644
--- a/man/lvcreate.8.in
+++ b/man/lvcreate.8.in
@@ -1,7 +1,22 @@
.TH LVCREATE 8 "LVM TOOLS #VERSION#" "Sistina Software UK" \" -*- nroff -*-
+.
+.\" Use 1st. parameter with \% to fix 'man2html' rendeing on same line!
+.de SIZE_G
+. IR \\$1 \c
+. RB [ b | B | s | S | k | K | m | M | g | G ]
+..
+.de SIZE_E
+. IR \\$1 \c
+. RB [ b | B | s | S | k | K | m | M | \c
+. BR g | G | t | T | p | P | e | E ]
+..
+.
.SH NAME
+.
lvcreate \- create a logical volume in an existing volume group
+.
.SH SYNOPSIS
+.
.ad l
.B lvcreate
.RB [ \-a | \-\-activate
@@ -17,7 +32,7 @@ lvcreate \- create a logical volume in an existing volume group
.RB { passthrough | writeback | writethrough }]
.RB [ \-\-cachepolicy
.IR policy ]
-.RB [ \-\-cachepool
+.RB \%[ \-\-cachepool
.IR CachePoolLogicalVolume ]
.RB [ \-\-cachesettings
.IR key \fB= value ]
@@ -25,7 +40,7 @@ lvcreate \- create a logical volume in an existing volume group
.IR ChunkSize ]
.RB [ \-\-commandprofile
.IR ProfileName ]
-.RB [ \-C | \-\-contiguous
+.RB \%[ \-C | \-\-contiguous
.RB { y | n }]
.RB [ \-d | \-\-debug ]
.RB [ \-\-discards
@@ -78,7 +93,7 @@ lvcreate \- create a logical volume in an existing volume group
.IR Rate ]
.RB [ \-r | \-\-readahead
.RB { \fIReadAheadSectors | auto | none }]
-.RB [ \-k | \-\-setactivationskip
+.RB \%[ \-k | \-\-setactivationskip
.RB { y | n }]
.RB [ \-s | \-\-snapshot ]
.RB [ \-V | \-\-virtualsize
@@ -94,9 +109,10 @@ lvcreate \- create a logical volume in an existing volume group
.RB { y | n }]
.RB [ \-Z | \-\-zero
.RB { y | n }]
-.RI [ VolumeGroup [ \fB/ { ExternalOrigin |\: Origin |
-.IR Pool } LogicalVolumeName ]
-.RI [ PhysicalVolumePath [ \fB: \fIPE \fR[ \fB\- PE ]]...]
+.RI [ VolumeGroup \c
+.RB [ / \c
+.RI { ExternalOrigin | Origin | Pool } LogicalVolumeName
+.RI [ PhysicalVolumePath [ \fB: \fIPE \fR[ \fB\- PE ]]...]]
.LP
.B lvcreate
.RB [ \-l | \-\-extents
@@ -107,7 +123,7 @@ lvcreate \- create a logical volume in an existing volume group
.IR LogicalVolumeSize ]
.RB [ \-c | \-\-chunksize
.IR ChunkSize ]
-.RB [ \-\-commandprofile
+.RB \%[ \-\-commandprofile
.IR Profile\%Name ]
.RB [ \-\-noudevsync ]
.RB [ \-\-ignoremonitoring ]
@@ -118,11 +134,13 @@ lvcreate \- create a logical volume in an existing volume group
.RB [ \-n | \-\-name
.IR SnapshotLogicalVolume ]
.BR \-s | \-\-snapshot | \-H | \-\-cache
-.RI \%{[ VolumeGroup \fB/ ] OriginalLogicalVolume
-.BR \-V | \-\-virtualsize
-.IR VirtualSize }
+.RI \%{[ VolumeGroup \fB/\fP] OriginalLogicalVolume
+.RB \%[ \-V | \-\-virtualsize
+.IR VirtualSize ]}
.ad b
+.
.SH DESCRIPTION
+.
lvcreate creates a new logical volume in a volume group (see
.BR vgcreate "(8), " vgchange (8))
by allocating logical extents from the free physical extent pool
@@ -151,40 +169,41 @@ for common options.
.br
Controls the availability of the Logical Volumes for immediate use after
the command finishes running.
-By default, new Logical Volumes are activated (\fB\-a\fIy\fR).
-If it is possible technically, \fB\-a\fIn\fR will leave the new Logical
+By default, new Logical Volumes are activated (\fB\-ay\fP).
+If it is possible technically, \fB\-an\fP will leave the new Logical
Volume inactive. But for example, snapshots of active origin can only be
-created in the active state so \fB\-a\fIn\fR cannot be used with
-\fB-\-type\fP \fIsnapshot\fP. This does not apply to thin volume snapshots,
+created in the active state so \fB\-an\fP cannot be used with
+\fB-\-type snapshot\fP. This does not apply to thin volume snapshots,
which are by default created with flag to skip their activation
-(\fB-k\fP\fIy\fP).
-Normally the \fB\-\-zero\fP \fIn\fP argument has to be supplied too because
+(\fB-ky\fP).
+Normally the \fB\-\-zero n\fP argument has to be supplied too because
zeroing (the default behaviour) also requires activation.
-If autoactivation option is used (\fB\-a\fIay\fR), the logical volume is
+If autoactivation option is used (\fB\-aay\fP), the logical volume is
activated only if it matches an item in the
-.IR activation / auto_activation_volume_list
+\fBactivation/auto_activation_volume_list\fP
set in \fBlvm.conf\fP(5).
-For autoactivated logical volumes, \fB\-\-zero\fP \fIn\fP and
-\fB\-\-wipesignatures\fP \fIn\fP is always assumed and it can't
+For autoactivated logical volumes, \fB\-\-zero n\fP and
+\fB\-\-wipesignatures n\fP is always assumed and it can't
be overridden. If the clustered locking is enabled,
-\fB\-a\fIey\fR will activate exclusively on one node and
-.IR \fB\-a { a | l } y
+\fB\-aey\fP will activate exclusively on one node and
+.BR \-a { a | l } y
will activate only on the local node.
.
.HP
.BR \-H | \-\-cache
.br
-Creates cache or cache pool logical volume or both.
-Specifying the optional argument \fB\-\-size\fP will cause the creation of
-the cache logical volume.
+Creates cache or cache pool logical volume.
+.\" or both.
+Specifying the optional argument \fB\-\-extents\fP or \fB\-\-size\fP
+will cause the creation of the cache logical volume.
.\" Specifying the optional argument \fB\-\-pooldatasize\fP will cause
.\" the creation of the cache pool logical volume.
-Specifying both arguments will cause the creation of cache with its
-cache pool volume.
+.\" Specifying both arguments will cause the creation of cache with its
+.\" cache pool volume.
When the Volume group name is specified together with existing logical volume
-name which is NOT a cache pool name, such volume is treaded
-as cache origin volume and cache pool is created. In this case
-the \fB\-\-size\fP is used to specify size of cache pool volume.
+name which is NOT a cache pool name, such volume is treated
+as cache origin volume and cache pool is created. In this case the
+\fB\-\-extents\fP or \fB\-\-size\fP is used to specify size of cache pool volume.
See \fBlvmcache\fP(7) for more info about caching support.
Note that the cache segment type requires a dm-cache kernel module version
1.3.0 or greater.
@@ -228,19 +247,18 @@ and removes it from the list of settings stored in lvm2 metadata.
.
.HP
.BR \-c | \-\-chunksize
-.IR ChunkSize \c
-.RB [ b | B | s | S | k | K | m | M | g | G ]
+.SIZE_G \%ChunkSize
.br
Gives the size of chunk for snapshot, cache pool and thin pool logical volumes.
Default unit is in kilobytes.
.br
-For \fIsnapshots\fP the value must be power of 2 between 4KiB and 512KiB
+For snapshots the value must be power of 2 between 4KiB and 512KiB
and the default value is 4KiB.
.br
-For \fIcache pools\fP the value must a multiple of 32KiB
+For cache pools the value must a multiple of 32KiB
between 32KiB and 1GiB. The default is 64KiB.
.br
-For \fIthin pools\fP the value must be a multiple of 64KiB
+For thin pools the value must be a multiple of 64KiB
between 64KiB and 1GiB.
Default value starts with 64KiB and grows up to
fit the pool metadata size within 128MiB,
@@ -279,7 +297,7 @@ Default is \fBpassdown\fP.
Configures thin pool behaviour when data space is exhausted.
Default is \fBn\fPo.
Device will queue I/O operations until target timeout
-(see dm-thin-pool kernel module option \fIno_space_timeout\fP)
+(see dm-thin-pool kernel module option \fPno_space_timeout\fP)
expires. Thus configured system has a time to i.e. extend
the size of thin pool data device.
When set to \fBy\fPes, the I/O operation is immeditelly errored.
@@ -313,7 +331,7 @@ PhysicalVolume(s) with the suffix \fB%PVS\fP, or (for a snapshot) as a
percentage of the total space in the Origin Logical Volume with the
suffix \fB%ORIGIN\fP (i.e. \fB100%ORIGIN\fP provides space for the whole origin).
When expressed as a percentage, the number is treated
-as an approximate upper limit for the total number of physical extents
+as an approximate upper limit for the number of physical extents
to be allocated (including extents used by any mirrors, for example).
.
.HP
@@ -330,7 +348,7 @@ numbers are dynamically assigned.
.BR \-\-metadataprofile
.IR ProfileName
.br
-Uses and attaches the ProfileName configuration profile to the logical
+Uses and attaches the \fIProfileName\fP configuration profile to the logical
volume metadata. Whenever the logical volume is processed next time,
the profile is automatically applied. If the volume group has another
profile attached, the logical volume profile is preferred.
@@ -448,7 +466,7 @@ Otherwise it is \fBn\fPo.
.
.HP
.BR \-\-poolmetadatasize
-.BR \fIMetadataVolumeSize [ b | B | s | S | k | K | m | M | g | G ]
+.SIZE_G \%MetadataVolumeSize
.br
Sets the size of pool's metadata logical volume.
Supported values are in range between 2MiB and 16GiB for thin pool,
@@ -469,7 +487,7 @@ Default is \fBy\fPes.
.
.HP
.BR \-\- [ raid ] maxrecoveryrate
-.BR \fIRate [ b | B | s | S | k | K | m | M | g | G ]
+.SIZE_G \%Rate
.br
Sets the maximum recovery rate for a RAID logical volume. \fIRate\fP
is specified as an amount per second for each device in the array.
@@ -478,7 +496,7 @@ recovery rate to 0 means it will be unbounded.
.
.HP
.BR \-\- [ raid ] minrecoveryrate
-.BR \fIRate [ b | B | s | S | k | K | m | M | g | G ]
+.SIZE_G \%Rate
.br
Sets the minimum recovery rate for a RAID logical volume. \fIRate\fP
is specified as an amount per second for each device in the array.
@@ -498,7 +516,7 @@ a suitable value automatically.
.
.HP
.BR \-R | \-\-regionsize
-.BR \fIMirrorLogRegionSize [ b | B | s | S | k | K | m | M | g | G ]
+.SIZE_G \%MirrorLogRegionSize
.br
A mirror is divided into regions of this size (in MiB), and the mirror log
uses this granularity to track which regions are in sync.
@@ -522,9 +540,7 @@ where the state of the flag is reported within \fBlv_attr\fP bits.
.
.HP
.BR \-L | \-\-size
-.BR \fILogicalVolumeSize [ b | B | s | S | k | K | m | M | \c
-.BR g | G | t | T | p | P | e | E ]
-.\" man2html cannot handle all those changes in 1 line
+.SIZE_E \%LogicalVolumeSize
.br
Gives the size to allocate for the new logical volume.
A size suffix of \fBB\fP for bytes, \fBS\fP for sectors as 512 bytes,
@@ -533,8 +549,11 @@ A size suffix of \fBB\fP for bytes, \fBS\fP for sectors as 512 bytes,
or \fBE\fP for exabytes is optional.
.br
Default unit is megabytes.
-.TP
-.IR \fB\-s ", " \fB\-\-snapshot " " OriginalLogicalVolume { Name | Path }
+.
+.HP
+.BR \-s | \fB\-\-snapshot
+.IR OriginalLogicalVolume { Name | Path }
+.br
Creates a snapshot logical volume (or snapshot) for an existing, so called
original logical volume (or origin).
Snapshots provide a 'frozen image' of the contents of the origin
@@ -567,29 +586,35 @@ External origin volume can be used/shared for many thin volumes
even from different thin pools. See
.BR lvconvert (8)
for online conversion to thin volumes with external origin.
-.TP
-.BR \-i ", " \-\-stripes " " \fIStripes
+.
+.HP
+.BR \-i | \-\-stripes
+.IR Stripes
+.br
Gives the number of stripes.
This is equal to the number of physical volumes to scatter
the logical volume. When creating a RAID 4/5/6 logical volume,
the extra devices which are necessary for parity are
-internally accounted for. Specifying
-.BI \-i 3
+internally accounted for. Specifying \fB\-i 3\fP
would use 3 devices for striped logical volumes,
4 devices for RAID 4/5, and 5 devices for RAID 6. Alternatively,
RAID 4/5/6 will stripe across all PVs in the volume group or
-all of the PVs specified if the
-.B \-i
+all of the PVs specified if the \fB\-i\fP
argument is omitted.
-.TP
-.BR \-I ", " \-\-stripesize " " \fIStripeSize
+.
+.HP
+.BR \-I | \-\-stripesize
+.IR StripeSize
+.br
Gives the number of kilobytes for the granularity of the stripes.
.br
StripeSize must be 2^n (n = 2 to 9) for metadata in LVM1 format.
For metadata in LVM2 format, the stripe size may be a larger
power of 2 but must not exceed the physical extent size.
-.TP
-.IR \fB\-T ", " \fB\-\-thin
+.
+.HP
+.BR \-T | \-\-thin
+.br
Creates thin pool or thin logical volume or both.
Specifying the optional argument \fB\-\-size\fP or \fB\-\-extents\fP
will cause the creation of the thin pool logical volume.
@@ -600,81 +625,93 @@ thin pool and thin volume using this pool.
See \fBlvmthin\fP(7) for more info about thin provisioning support.
Thin provisioning requires device mapper kernel driver
from kernel 3.2 or greater.
-.TP
-.IR \fB\-\-thinpool " " ThinPoolLogicalVolume { Name | Path }
+.
+.HP
+.BR \-\-thinpool
+.IR ThinPoolLogicalVolume { Name | Path }
+.br
Specifies the name of thin pool volume name. The other way to specify pool name
is to append name to Volume group name argument.
-.TP
-.B \-\-type \fISegmentType
+.
+.HP
+.BR \-\-type
+.IR SegmentType
+.br
Creates a logical volume with the specified segment type.
Supported types are:
-.IR cache ,
-.IR cache-pool ,
-.IR error ,
-.IR linear ,
-.IR mirror,
-.IR raid1 ,
-.IR raid4 ,
-.IR raid5_la ,
-.IR raid5_ls " (= " raid5 ),
-.IR raid5_ra ,
-.IR raid5_rs ,
-.IR raid6_nc ,
-.IR raid6_nr ,
-.IR raid6_zr " (= " raid6 ) ,
-.IR raid10 ,
-.IR snapshot ,
-.IR striped,
-.IR thin ,
-.IR thin-pool
+.BR cache ,
+.BR cache-pool ,
+.BR error ,
+.BR linear ,
+.BR mirror,
+.BR raid1 ,
+.BR raid4 ,
+.BR raid5_la ,
+.BR raid5_ls
+.RB (=
+.BR raid5 ),
+.BR raid5_ra ,
+.BR raid5_rs ,
+.BR raid6_nc ,
+.BR raid6_nr ,
+.BR raid6_zr
+.RB (=
+.BR raid6 ),
+.BR raid10 ,
+.BR snapshot ,
+.BR striped,
+.BR thin ,
+.BR thin-pool
or
-.IR zero .
+.BR zero .
Segment type may have a commandline switch alias that will
enable its use.
When the type is not explicitly specified an implicit type
is selected from combination of options:
-.BR \-H | \-\-cache | \-\-cachepool " (" \fIcache
-or
-.IR cachepool ),
-.BR \-T | \-\-thin | \-\-thinpool " (" \fIthin
-or
-.IR thinpool ),
-.BR \-m | \-\-mirrors " (" \fIraid1
-or
-.IR mirror ),
-.BR \-s | \-\-snapshot | \-V | \-\-virtualsize " (" \fIsnapshot
-or
-.IR thin ),
-.BR \-i | \-\-stripes " (" \fIstriped ).
-Default type is \fIlinear\fP.
-.TP
-.BR \-V ", " \-\-virtualsize " " \fIVirtualSize [ \fIbBsSkKmMgGtTpPeE ]
+.BR \-H | \-\-cache | \-\-cachepool
+(cache or cachepool),
+.BR \-T | \-\-thin | \-\-thinpool
+(thin or thinpool),
+.BR \-m | \-\-mirrors
+(raid1 or mirror),
+.BR \-s | \-\-snapshot | \-V | \-\-virtualsize
+(snapshot or thin),
+.BR \-i | \-\-stripes
+(striped).
+Default segment type is \fBlinear\fP.
+.
+.HP
+.BR \-V | \-\-virtualsize
+.SIZE_E \%VirtualSize
+.br
Creates a thinly provisioned device or a sparse device of the given size (in MiB by default).
See
.BR lvm.conf (5)
-settings
-.IR global / sparse_segtype_default
+settings \fBglobal/sparse_segtype_default\fP
to configure default sparse segment type.
See \fBlvmthin\fP(7) for more info about thin provisioning support.
Anything written to a sparse snapshot will be returned when reading from it.
Reading from other areas of the device will return blocks of zeros.
-Virtual snapshot is implemented by creating a hidden virtual device of the
-requested size using the zero target. A suffix of _vorigin is used for
-this device. Note: using sparse snapshots is not efficient for larger
+Virtual snapshot (sparse snapshot) is implemented by creating
+a hidden virtual device of the requested size using the zero target.
+A suffix of _vorigin is used for this device.
+Note: using sparse snapshots is not efficient for larger
device sizes (GiB), thin provisioning should be used for this case.
-.TP
-.BR \-W ", " \-\-wipesignatures " {" \fIy | \fIn }
+.
+.HP
+.BR \-W | \-\-wipesignatures
+.RB { y | n }
+.br
Controls wiping of detected signatures on newly created Logical Volume.
If this option is not specified, then by default signature wiping is done
-each time the zeroing (\fB\-Z\fP/\fB\-\-zero\fP) is done. This default behaviour
-can be controlled by
-.IR allocation / wipe_signatures_when_zeroing_new_lvs
+each time the zeroing (
+.BR \-Z | \-\-zero
+) is done. This default behaviour
+can be controlled by \fB\%allocation/wipe_signatures_when_zeroing_new_lvs\fP
setting found in
.BR lvm.conf (5).
.br
-If blkid wiping is used
-.IR allocation / use_blkid_wiping
-setting in
+If blkid wiping is used \fBallocation/use_blkid_wiping\fP setting in
.BR lvm.conf (5))
and LVM2 is compiled with blkid wiping support, then \fBblkid\fP(8) library is used
to detect the signatures (use \fBblkid \-k\fP command to list the signatures that are recognized).
@@ -682,17 +719,21 @@ Otherwise, native LVM2 code is used to detect signatures (MD RAID, swap and LUKS
signatures are detected only in this case).
.br
Logical volume is not wiped if the read only flag is set.
-.TP
-.BR \-Z ", " \-\-zero " {" \fIy | \fIn }
+.
+.HP
+.BR \-Z | \-\-zero
+.RB { y | n }
+.br
Controls zeroing of the first 4KiB of data in the new logical volume.
-Default is \fIy\fPes.
+Default is \fBy\fPes.
Snapshot COW volumes are always zeroed.
Logical volume is not zeroed if the read only flag is set.
-
.br
Warning: trying to mount an unzeroed logical volume can cause the system to
hang.
+.
.SH Examples
+.
Creates a striped logical volume with 3 stripes, a stripe size of 8KiB
and a size of 100MiB in the volume group named vg00.
The logical volume name will be chosen by lvcreate:
@@ -701,8 +742,8 @@ The logical volume name will be chosen by lvcreate:
Creates a mirror logical volume with 2 sides with a useable size of 500 MiB.
This operation would require 3 devices (or option
-.BI \-\-alloc \ anywhere
-) - two for the mirror devices and one for the disk log:
+\fB\-\-alloc \%anywhere\fP) - two for the mirror
+devices and one for the disk log:
.sp
.B lvcreate \-m1 \-L 500M vg00
@@ -794,8 +835,10 @@ volume (i.e. the origin LV), creating a cache LV.
.\" Create a 1G cached LV "lvol1" with 10M cache pool "vg00/pool".
.\" .sp
.\" .B lvcreate \-\-cache \-L 1G \-n lv \-\-pooldatasize 10M vg00/pool
-
+.
.SH SEE ALSO
+.
+.nh
.BR lvm (8),
.BR lvm.conf (5),
.BR lvmcache (7),
diff --git a/man/lvm.8.in b/man/lvm.8.in
index 8ff31ae..31f7187 100644
--- a/man/lvm.8.in
+++ b/man/lvm.8.in
@@ -757,6 +757,7 @@ directly.
.
.SH SEE ALSO
.
+.nh
.BR lvm.conf (5),
.BR lvmcache (7),
.BR lvmthin (7),
7 years, 5 months
master - man: fsadm
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=4b1cadbd87a081...
Commit: 4b1cadbd87a0814a46b36b07cfe94eda7baacb28
Parent: 2506275c3b5ec7db8c76ef7fdb07d4f3083a3684
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Oct 5 12:28:00 2015 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Oct 6 15:21:36 2015 +0200
man: fsadm
---
man/fsadm.8.in | 95 ++++++++++++++++++++++++++++++++++++-----------------
scripts/fsadm.sh | 4 +-
2 files changed, 66 insertions(+), 33 deletions(-)
diff --git a/man/fsadm.8.in b/man/fsadm.8.in
index 2aecd65..02431c5 100644
--- a/man/fsadm.8.in
+++ b/man/fsadm.8.in
@@ -2,72 +2,105 @@
.SH "NAME"
fsadm \(em utility to resize or check filesystem on a device
.SH SYNOPSIS
+.
+.PD 0
+.ad l
+.HP 5
.B fsadm
.RI [ options ]
-.B check
-.I device
-.sp
+.BR check
+.IR device
+.
+.HP
.B fsadm
.RI [ options ]
-.B resize
-.I device
-.RI [ new_size [ BKMGTEP ]]
-.sp
+.BR resize
+.IR device
+.RI [ new_size ]
+.PD
+.ad b
+.
.SH DESCRIPTION
+.
fsadm utility checks or resizes the filesystem on a device.
-It tries to use the same API for
-.IR ext2 ", " ext3 ", " ext4 ", " ReiserFS " and " XFS
+It tries to use the same API for
+.BR ext2 ,
+.BR ext3 ,
+.BR ext4 ,
+.BR ReiserFS
+.RB and
+.BR XFS
filesystem.
+.
.SH OPTIONS
-.TP
-.BR \-e ", " \-\-ext\-offline
+.
+.HP
+.BR \-e | \-\-ext\-offline
+.br
Unmount ext2/ext3/ext4 filesystem before doing resize.
-.TP
-.BR \-f ", " \-\-force
+.
+.HP
+.BR \-f | \-\-force
+.br
Bypass some sanity checks.
-.TP
-.BR \-h ", " \-\-help
+.
+.HP
+.BR \-h | \-\-help
+.br
Display the help text.
-.TP
-.BR \-n ", " \-\-dry\-run
+.
+.HP
+.BR \-n | \-\-dry\-run
+.br
Print commands without running them.
-.TP
-.BR \-v ", " \-\-verbose
+.
+.HP
+.BR \-v | \-\-verbose
+.br
Be more verbose.
-.TP
-.BR \-y ", " \-\-yes
+.
+.HP
+.BR \-y | \-\-yes
+.br
Answer "yes" at any prompts.
-.TP
-.I new_size
+.
+.HP
+.BR \fInew_size [ B | K | M | G | T | P | E ]
+.br
Absolute number of filesystem blocks to be in the filesystem,
or an absolute size using a suffix (in powers of 1024).
If new_size is not supplied, the whole device is used.
-
+.
.SH DIAGNOSTICS
+.
On successful completion, the status code is 0.
A status code of 2 indicates the operation was interrupted by the user.
A status code of 3 indicates the requested check operation could not be performed
-because the filesystem is mounted and does not support an online
+because the filesystem is mounted and does not support an online
.BR fsck (8).
A status code of 1 is used for other failures.
-
+.
.SH EXAMPLES
-Resize the filesystem on logical volume /dev/vg/test to 1000 megabytes.
-If /dev/vg/test contains ext2/ext3/ext4
+.
+Resize the filesystem on logical volume \fI/dev/vg/test\fP to 1000 megabytes.
+If \fI/dev/vg/test\fP contains ext2/ext3/ext4
filesystem it will be unmounted prior the resize.
All [y/n] questions will be answered 'y'.
.sp
.B fsadm \-e \-y resize /dev/vg/test 1000M
+.
.SH ENVIRONMENT VARIABLES
+.
.TP
-.B TMPDIR
-The temporary directory name for mount points. Defaults to "/tmp".
+.B "TMPDIR "
+The temporary directory name for mount points. Defaults to "\fI/tmp\fP".
.TP
.B DM_DEV_DIR
The device directory name.
-Defaults to "/dev" and must be an absolute path.
+Defaults to "\fI/dev\fP" and must be an absolute path.
.SH SEE ALSO
+.nh
.BR lvm (8),
.BR lvresize (8),
.BR lvm.conf (5),
diff --git a/scripts/fsadm.sh b/scripts/fsadm.sh
index f4ea796..e1aacd8 100755
--- a/scripts/fsadm.sh
+++ b/scripts/fsadm.sh
@@ -86,10 +86,10 @@ NL='
tool_usage() {
echo "${TOOL}: Utility to resize or check the filesystem on a device"
echo
- echo " ${TOOL} [options] check device"
+ echo " ${TOOL} [options] check <device>"
echo " - Check the filesystem on device using fsck"
echo
- echo " ${TOOL} [options] resize device [new_size[BKMGTPE]]"
+ echo " ${TOOL} [options] resize <device> [<new_size>[BKMGTPE]]"
echo " - Change the size of the filesystem on device to new_size"
echo
echo " Options:"
7 years, 5 months
master - cleanup: fix compiler warning
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=2506275c3b5ec7...
Commit: 2506275c3b5ec7db8c76ef7fdb07d4f3083a3684
Parent: 5f7a94a03e8ff61213844fd510e8af127475b501
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sat Oct 3 22:10:31 2015 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Oct 6 14:57:30 2015 +0200
cleanup: fix compiler warning
---
lib/cache/lvmetad.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/cache/lvmetad.c b/lib/cache/lvmetad.c
index db15866..20d2001 100644
--- a/lib/cache/lvmetad.c
+++ b/lib/cache/lvmetad.c
@@ -53,8 +53,8 @@ static int _log_debug_inequality(const char *name, struct dm_config_node *a, str
log_debug_lvmetad("VG %s metadata inequality at %s / %s: %s / %s",
name, a->key, b->key, av->v.str, bv->v.str);
else if (a->v->type == DM_CFG_INT && b->v->type == DM_CFG_INT)
- log_debug_lvmetad("VG %s metadata inequality at %s / %s: %li / %li",
- name, a->key, b->key, (int64_t)av->v.i, (int64_t)bv->v.i);
+ log_debug_lvmetad("VG %s metadata inequality at %s / %s: " FMTi64 " / " FMTi64,
+ name, a->key, b->key, av->v.i, bv->v.i);
else
log_debug_lvmetad("VG %s metadata inequality at %s / %s: type %d / type %d",
name, a->key, b->key, av->type, bv->type);
7 years, 5 months
master - blkdeactivate: recognize and deactivate MD devices too
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=5f7a94a03e8ff6...
Commit: 5f7a94a03e8ff61213844fd510e8af127475b501
Parent: df59db6048a6be79acf231b98fd560b11cce7c7c
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Tue Oct 6 13:25:37 2015 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Tue Oct 6 13:25:41 2015 +0200
blkdeactivate: recognize and deactivate MD devices too
---
WHATS_NEW_DM | 1 +
man/blkdeactivate.8.in | 10 ++++++----
scripts/blkdeactivate.sh.in | 33 +++++++++++++++++++++++++++++++++
3 files changed, 40 insertions(+), 4 deletions(-)
diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM
index c1c48ea..e89ead0 100644
--- a/WHATS_NEW_DM
+++ b/WHATS_NEW_DM
@@ -1,5 +1,6 @@
Version 1.02.110 -
======================================
+ Add support for recognition and deactivation of MD devices to blkdeactivate.
Move target status functions out of libdm-deptree.
Correct use of max_write_behind parameter when generating raid target line.
Fix dm-event systemd service to make sure it is executed before mounting.
diff --git a/man/blkdeactivate.8.in b/man/blkdeactivate.8.in
index 990be4a..2eb4c6f 100644
--- a/man/blkdeactivate.8.in
+++ b/man/blkdeactivate.8.in
@@ -14,10 +14,11 @@ blkdeactivate \(em utility to deactivate block devices
blkdeactivate utility deactivates block devices. If a device
is mounted, the utility can unmount it automatically before
trying to deactivate. The utility currently supports
-device-mapper devices, including LVM volumes.
-LVM volumes are handled directly using the \fBlvm\fP(8) command.
-Other device-mapper based devices are handled using the
-\fBdmsetup\fP(8) command.
+device-mapper devices (DM), including LVM volumes and
+software RAID MD devices. LVM volumes are handled directly
+using the \fBlvm\fP(8) command, the rest of device-mapper
+based devices are handled using the \fBdmsetup\fP(8) command.
+MD devices are handled using the \fBmdadm\fP(8) command.
.SH OPTIONS
.TP
.BR \-d ", " \-\-dmoption \ \fIdm_options\fP
@@ -88,4 +89,5 @@ of device-mapper devices in case the deactivation fails and force removal.
.BR dmsetup (8),
.BR lsblk (8),
.BR lvm (8),
+.BR mdadm (8),
.BR umount (8)
diff --git a/scripts/blkdeactivate.sh.in b/scripts/blkdeactivate.sh.in
index 993f151..dc1a006 100644
--- a/scripts/blkdeactivate.sh.in
+++ b/scripts/blkdeactivate.sh.in
@@ -37,6 +37,7 @@ SYS_BLK_DIR='/sys/block'
UMOUNT="/bin/umount"
DMSETUP="@sbindir@/dmsetup"
LVM="@sbindir@/lvm"
+MDADM="@sbindir@/mdadm"
if $UMOUNT --help | grep -- "--all-targets" >$DEV_DIR/null; then
UMOUNT_OPTS="--all-targets "
@@ -47,6 +48,7 @@ else
fi
DMSETUP_OPTS=""
LVM_OPTS=""
+MDADM_OPTS=""
LSBLK="/bin/lsblk -r --noheadings -o TYPE,KNAME,NAME,MOUNTPOINT"
LSBLK_VARS="local devtype local kname local name local mnt"
@@ -259,6 +261,28 @@ deactivate_lvm () {
fi
}
+deactivate_md () {
+ local name=$(printf $name)
+ test -b "$DEV_DIR/$name" || return 0
+ test -z ${SKIP_DEVICE_LIST["$kname"]} || return 1
+
+ # Skip MD device deactivation if MD tools missing.
+ test $MDADM_AVAILABLE -eq 0 && {
+ add_device_to_skip_list
+ return 1
+ }
+
+ deactivate_holders "$DEV_DIR/$name" || return 1
+
+ echo -n " [MD]: deactivating $devtype device $kname... "
+ if eval $MDADM $MDADM_OPTS -S "$name" $OUT $ERR; then
+ echo "done"
+ else
+ echo "skipping"
+ add_device_to_skip_list
+ fi
+}
+
deactivate () {
######################################################################
# DEACTIVATION HOOKS FOR NEW DEVICE TYPES GO HERE! #
@@ -277,6 +301,8 @@ deactivate () {
deactivate_lvm
elif test "${kname:0:3}" = "dm-"; then
deactivate_dm
+ elif test "${kname:0:2}" = "md"; then
+ deactivate_md
fi
}
@@ -392,6 +418,7 @@ set_env() {
UMOUNT_OPTS+="-v"
DMSETUP_OPTS+="-vvvv"
LVM_OPTS+="-vvvv"
+ MDADM_OPTS+="-vv"
else
OUT="1>$DEV_DIR/null"
fi
@@ -401,6 +428,12 @@ set_env() {
else
LVM_AVAILABLE=0
fi
+
+ if test -f $MDADM; then
+ MDADM_AVAILABLE=1
+ else
+ MDADM_AVAILABLE=0
+ fi
}
while test $# -ne 0; do
7 years, 5 months
master - lockd: add error message for EEXIST
by David Teigland
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=df59db6048a6be...
Commit: df59db6048a6be79acf231b98fd560b11cce7c7c
Parent: b33d7586e7f629818e881e26677f4431a47d50b5
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Fri Oct 2 15:41:23 2015 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Fri Oct 2 15:41:23 2015 -0500
lockd: add error message for EEXIST
The EEXIST error for LV locks is unusual, and
was missing an explanatory error message.
---
lib/locking/lvmlockd.c | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/lib/locking/lvmlockd.c b/lib/locking/lvmlockd.c
index afbafcb..f741940 100644
--- a/lib/locking/lvmlockd.c
+++ b/lib/locking/lvmlockd.c
@@ -2010,6 +2010,15 @@ int lockd_lv_name(struct cmd_context *cmd, struct volume_group *vg,
return 0;
}
+ if (result == -EEXIST) {
+ /*
+ * This happens if lvchange tries to modify the LV with an ex
+ * LV lock when the LV is already active with a sh LV lock.
+ */
+ log_error("LV is already locked with incompatible mode: %s/%s", vg->name, lv_name);
+ return 0;
+ }
+
if (result == -EMSGSIZE) {
/* Another host probably extended lvmlock. */
if (!refreshed++) {
7 years, 5 months
master - raid_manip: fix wrong image size allocation on raid10 "lvconvert --replace ..."
by Heinz Mauelshagen
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=b33d7586e7f629...
Commit: b33d7586e7f629818e881e26677f4431a47d50b5
Parent: fb957ef3223939424cf1faff4ca9dd104882ab46
Author: Heinz Mauelshagen <heinzm(a)redhat.com>
AuthorDate: Fri Oct 2 17:09:37 2015 +0200
Committer: Heinz Mauelshagen <heinzm(a)redhat.com>
CommitterDate: Fri Oct 2 17:09:37 2015 +0200
raid_manip: fix wrong image size allocation on raid10 "lvconvert --replace ..."
---
lib/metadata/raid_manip.c | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/lib/metadata/raid_manip.c b/lib/metadata/raid_manip.c
index 5919e3b..c420733 100644
--- a/lib/metadata/raid_manip.c
+++ b/lib/metadata/raid_manip.c
@@ -460,9 +460,12 @@ static int _alloc_image_components(struct logical_volume *lv,
* individual devies, we must specify how large the individual device
* is along with the number we want ('count').
*/
- extents = (segtype->parity_devs) ?
- (lv->le_count / (seg->area_count - segtype->parity_devs)) :
- lv->le_count;
+ if (segtype_is_raid10(segtype))
+ extents = lv->le_count / (seg->area_count / 2); /* we enforce 2 mirrors right now */
+ else
+ extents = (segtype->parity_devs) ?
+ (lv->le_count / (seg->area_count - segtype->parity_devs)) :
+ lv->le_count;
if (!(ah = allocate_extents(lv->vg, NULL, segtype, 0, count, count,
region_size, extents, pvs,
7 years, 5 months
master - raid: Add metadata dev information to reports.
by Alasdair Kergon
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=fb957ef3223939...
Commit: fb957ef3223939424cf1faff4ca9dd104882ab46
Parent: 5e5d48348b0c7afdd7a3fb56ddd6875a8b81dc68
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Fri Oct 2 10:09:28 2015 +0100
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Fri Oct 2 10:09:28 2015 +0100
raid: Add metadata dev information to reports.
Add metadata_devices and seg_metadata_le_ranges report fields.
Currently only defined for raid, but should probably be extended
to all other segment types that don't report all their device
usage in the 'devices' field.
---
WHATS_NEW | 1 +
lib/metadata/lv.c | 31 ++++++++++++++++++++++++-------
lib/metadata/lv.h | 2 ++
lib/report/columns.h | 2 ++
lib/report/properties.c | 5 +++++
lib/report/report.c | 24 ++++++++++++++++++++++++
6 files changed, 58 insertions(+), 7 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index d693ab8..5da1552 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.133 -
======================================
+ Add metadata_devices and seg_metadata_le_ranges report fields for raid vols.
Fix lvm2-{activation,clvmd,cmirrord,monitor} service to exec before mounting.
Version 2.02.132 - 22nd September 2015
diff --git a/lib/metadata/lv.c b/lib/metadata/lv.c
index e0080b1..3126086 100644
--- a/lib/metadata/lv.c
+++ b/lib/metadata/lv.c
@@ -29,7 +29,7 @@ static struct utsname _utsname;
static int _utsinit = 0;
static char *_format_pvsegs(struct dm_pool *mem, const struct lv_segment *seg,
- int range_format)
+ int range_format, int metadata_areas_only)
{
unsigned int s;
const char *name = NULL;
@@ -41,13 +41,19 @@ static char *_format_pvsegs(struct dm_pool *mem, const struct lv_segment *seg,
return NULL;
}
+ if (metadata_areas_only && (!seg_is_raid(seg) || lv_is_raid_metadata(seg->lv) || lv_is_raid_image(seg->lv)))
+ goto out;
+
for (s = 0; s < seg->area_count; s++) {
- switch (seg_type(seg, s)) {
+ switch (metadata_areas_only ? seg_metatype(seg, s) : seg_type(seg, s)) {
case AREA_LV:
- name = seg_lv(seg, s)->name;
- extent = seg_le(seg, s);
+ name = metadata_areas_only ? seg_metalv(seg, s)->name : seg_lv(seg, s)->name;
+ extent = metadata_areas_only ? seg_le(seg, s) : 0;
break;
case AREA_PV:
+ /* Raid metadata never uses PVs directly */
+ if (metadata_areas_only)
+ continue;
name = dev_name(seg_dev(seg, s));
extent = seg_pe(seg, s);
break;
@@ -79,7 +85,7 @@ static char *_format_pvsegs(struct dm_pool *mem, const struct lv_segment *seg,
if (range_format) {
if (dm_snprintf(extent_str, sizeof(extent_str),
- FMTu32, extent + seg->area_len - 1) < 0) {
+ FMTu32, metadata_areas_only ? extent + seg_metalv(seg, s)->le_count - 1 : extent + seg->area_len - 1) < 0) {
log_error("Extent number dm_snprintf failed");
return NULL;
}
@@ -96,6 +102,7 @@ static char *_format_pvsegs(struct dm_pool *mem, const struct lv_segment *seg,
}
}
+out:
if (!dm_pool_grow_object(mem, "\0", 1)) {
log_error("dm_pool_grow_object failed");
return NULL;
@@ -106,12 +113,22 @@ static char *_format_pvsegs(struct dm_pool *mem, const struct lv_segment *seg,
char *lvseg_devices(struct dm_pool *mem, const struct lv_segment *seg)
{
- return _format_pvsegs(mem, seg, 0);
+ return _format_pvsegs(mem, seg, 0, 0);
+}
+
+char *lvseg_metadata_devices(struct dm_pool *mem, const struct lv_segment *seg)
+{
+ return _format_pvsegs(mem, seg, 0, 1);
}
char *lvseg_seg_pe_ranges(struct dm_pool *mem, const struct lv_segment *seg)
{
- return _format_pvsegs(mem, seg, 1);
+ return _format_pvsegs(mem, seg, 1, 0);
+}
+
+char *lvseg_seg_metadata_le_ranges(struct dm_pool *mem, const struct lv_segment *seg)
+{
+ return _format_pvsegs(mem, seg, 1, 1);
}
char *lvseg_tags_dup(const struct lv_segment *seg)
diff --git a/lib/metadata/lv.h b/lib/metadata/lv.h
index a839489..172d29f 100644
--- a/lib/metadata/lv.h
+++ b/lib/metadata/lv.h
@@ -101,7 +101,9 @@ char *lvseg_cachemode_dup(struct dm_pool *mem, const struct lv_segment *seg);
char *lvseg_monitor_dup(struct dm_pool *mem, const struct lv_segment *seg);
char *lvseg_tags_dup(const struct lv_segment *seg);
char *lvseg_devices(struct dm_pool *mem, const struct lv_segment *seg);
+char *lvseg_metadata_devices(struct dm_pool *mem, const struct lv_segment *seg);
char *lvseg_seg_pe_ranges(struct dm_pool *mem, const struct lv_segment *seg);
+char *lvseg_seg_metadata_le_ranges(struct dm_pool *mem, const struct lv_segment *seg);
char *lv_time_dup(struct dm_pool *mem, const struct logical_volume *lv, int iso_mode);
char *lv_host_dup(struct dm_pool *mem, const struct logical_volume *lv);
int lv_set_creation(struct logical_volume *lv,
diff --git a/lib/report/columns.h b/lib/report/columns.h
index 3b58aee..6041eeb 100644
--- a/lib/report/columns.h
+++ b/lib/report/columns.h
@@ -190,7 +190,9 @@ FIELD(SEGS, seg, SIZ, "SSize", list, 5, segsize, seg_size, "Size of segment in c
FIELD(SEGS, seg, SIZ, "SSize", list, 5, segsizepe, seg_size_pe, "Size of segment in physical extents.", 0)
FIELD(SEGS, seg, STR_LIST, "Seg Tags", tags, 8, tags, seg_tags, "Tags, if any.", 0)
FIELD(SEGS, seg, STR, "PE Ranges", list, 9, peranges, seg_pe_ranges, "Ranges of Physical Extents of underlying devices in command line format.", 0)
+FIELD(SEGS, seg, STR, "Metadata LE Ranges", list, 18, metadataleranges, seg_metadata_le_ranges, "Ranges of Logical Extents of underlying metadata devices in command line format.", 0)
FIELD(SEGS, seg, STR, "Devices", list, 7, devices, devices, "Underlying devices used with starting extent numbers.", 0)
+FIELD(SEGS, seg, STR, "Metadata Devs", list, 13, metadatadevices, metadata_devices, "Underlying metadata devices used with starting extent numbers.", 0)
FIELD(SEGS, seg, STR, "Monitor", list, 7, segmonitor, seg_monitor, "Dmeventd monitoring status of the segment.", 0)
FIELD(SEGS, seg, STR, "Cache Policy", list, 12, cache_policy, cache_policy, "The cache policy (cached segments only).", 0)
FIELD(SEGS, seg, STR_LIST, "Cache Settings", list, 14, cache_settings, cache_settings, "Cache settings/parameters (cached segments only).", 0)
diff --git a/lib/report/properties.c b/lib/report/properties.c
index 72dcaff..262cc26 100644
--- a/lib/report/properties.c
+++ b/lib/report/properties.c
@@ -463,8 +463,13 @@ GET_LVSEG_STR_PROPERTY_FN(seg_tags, lvseg_tags_dup(lvseg))
GET_LVSEG_STR_PROPERTY_FN(seg_pe_ranges,
lvseg_seg_pe_ranges(lvseg->lv->vg->vgmem, lvseg))
#define _seg_pe_ranges_set prop_not_implemented_set
+GET_LVSEG_STR_PROPERTY_FN(seg_metadata_le_ranges,
+ lvseg_seg_metadata_le_ranges(lvseg->lv->vg->vgmem, lvseg))
+#define _seg_metadata_le_ranges_set prop_not_implemented_set
GET_LVSEG_STR_PROPERTY_FN(devices, lvseg_devices(lvseg->lv->vg->vgmem, lvseg))
#define _devices_set prop_not_implemented_set
+GET_LVSEG_STR_PROPERTY_FN(metadata_devices, lvseg_metadata_devices(lvseg->lv->vg->vgmem, lvseg))
+#define _metadata_devices_set prop_not_implemented_set
GET_LVSEG_STR_PROPERTY_FN(seg_monitor, lvseg_monitor_dup(lvseg->lv->vg->vgmem, lvseg))
#define _seg_monitor_set prop_not_implemented_set
diff --git a/lib/report/report.c b/lib/report/report.c
index bf2f1c8..7ac1ac5 100644
--- a/lib/report/report.c
+++ b/lib/report/report.c
@@ -1304,6 +1304,18 @@ static int _devices_disp(struct dm_report *rh __attribute__((unused)), struct dm
return _field_set_value(field, str, NULL);
}
+static int _metadatadevices_disp(struct dm_report *rh __attribute__((unused)), struct dm_pool *mem,
+ struct dm_report_field *field,
+ const void *data, void *private __attribute__((unused)))
+{
+ char *str;
+
+ if (!(str = lvseg_metadata_devices(mem, (const struct lv_segment *) data)))
+ return_0;
+
+ return _field_set_value(field, str, NULL);
+}
+
static int _peranges_disp(struct dm_report *rh __attribute__((unused)), struct dm_pool *mem,
struct dm_report_field *field,
const void *data, void *private __attribute__((unused)))
@@ -1316,6 +1328,18 @@ static int _peranges_disp(struct dm_report *rh __attribute__((unused)), struct d
return _field_set_value(field, str, NULL);
}
+static int _metadataleranges_disp(struct dm_report *rh __attribute__((unused)), struct dm_pool *mem,
+ struct dm_report_field *field,
+ const void *data, void *private __attribute__((unused)))
+{
+ char *str;
+
+ if (!(str = lvseg_seg_metadata_le_ranges(mem, (const struct lv_segment *) data)))
+ return_0;
+
+ return _field_set_value(field, str, NULL);
+}
+
static int _tags_disp(struct dm_report *rh, struct dm_pool *mem,
struct dm_report_field *field,
const void *data, void *private)
7 years, 5 months
master - man lvmcache: updates for mode and policy
by David Teigland
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=5e5d48348b0c7a...
Commit: 5e5d48348b0c7afdd7a3fb56ddd6875a8b81dc68
Parent: 26da6a3e10d2b8a84326288b53c8e9a6d82a3846
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Thu Oct 1 11:39:07 2015 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Thu Oct 1 14:23:39 2015 -0500
man lvmcache: updates for mode and policy
Correct some things, e.g. set mode and policy on
the cache lv, not the pool, lvm.conf field for
mode changed.
Add smq which was missing.
Make the sections on cache mode and cache policy
consistent in structure and style.
---
man/lvmcache.7.in | 74 ++++++++++++++++++++++++++++++-----------------------
1 files changed, 42 insertions(+), 32 deletions(-)
diff --git a/man/lvmcache.7.in b/man/lvmcache.7.in
index 7257386..44709d1 100644
--- a/man/lvmcache.7.in
+++ b/man/lvmcache.7.in
@@ -195,6 +195,7 @@ Users who are concerned about the possibility of failures in their fast
devices that could lead to data loss might consider making their cache
pool sub-LVs redundant.
+.I Example
.nf
0. Create an origin LV we wish to cache
# lvcreate \-L 10G \-n lv1 vg /dev/slow_devs
@@ -228,14 +229,18 @@ from the cache pool back to the origin LV. This mode will increase
performance, but the loss of a device associated with the cache pool LV
can result in lost data.
-The cache mode can be specified with the --cachemode option when a cache
-pool LV is created.
+With the \-\-cachemode option, the cache mode can be set when creating a
+cache LV, or changed on an existing cache LV. The current cache mode of a
+cache LV can be displayed with the cache_mode reporting option:
+
+.B lvs \-o+cache_mode VG/CacheLV
.BR lvm.conf (5)
-.B cache_pool_cachemode
+.B allocation/cache_mode
.br
defines the default cache mode.
+.I Example
.nf
0. Create an origin LV we wish to cache (yours may already exist)
# lvcreate \-L 10G \-n lv1 vg /dev/slow
@@ -246,50 +251,55 @@ defines the default cache mode.
2. Create a cache metadata LV
# lvcreate \-L 8M \-n cache1meta vg /dev/fast
-3. Create a cache pool LV specifying cache mode "writethrough"
-# lvconvert \-\-type cache\-pool \-\-poolmetadata vg/cache1meta \\
- \-\-cachemode writethrough vg/cache1
+3. Create a cache pool LV
+# lvconvert \-\-type cache\-pool \-\-poolmetadata vg/cache1meta vg/cache1
-4. Create a cache LV by combining the cache pool LV and origin LV
-# lvconvert \-\-type cache \-\-cachepool vg/cache1 vg/lv1
+4. Create a cache LV by combining the cache pool LV and origin LV,
+ and use the writethrough cache mode.
+# lvconvert \-\-type cache \-\-cachepool vg/cache1 \\
+ \-\-cachemode writethrough vg/lv1
.fi
-The cache mode can be changed on an existing LV with the command:
-.B lvconvert --cachemode writethrough|writeback VG/CacheLV
+.SS Cache policy
+\&
-.SS Cache policy & policy settings
+The cache subsystem has additional per-LV parameters: the cache policy to
+use, and possibly tunable parameters for the cache policy. Three policies
+are currently available: "smq" is the default policy, "mq" is an older
+implementation, and "cleaner" is used to force the cache to write back
+(flush) all cached writes to the origin LV.
-\&
+The "mq" policy has a number of tunable parameters. The defaults are
+chosen to be suitable for the majority of systems, but in special
+circumstances, changing the settings can improve performance.
-The cache subsystem has an additional per-LV parameter, namely the cache policy
-to use, and possibly the tunable parameters of the said cache policy. In the
-current implementation, two policies are available, "mq" which is the default
-policy and "cleaner" which is used to force the cache to write back (flush) all
-cached writes to the origin LV. Moreover, the "mq" policy has a number of
-tunable parameters: the defaults are chosen to be suitable for the vast
-majority of systems. However, under special circumstances, changing the tunable
-settings of the cache policy can improve performance.
+With the \-\-cachepolicy and \-\-cachesettings options, the cache policy
+and settings can be set when creating a cache LV, or changed on an
+existing cache LV (both options can be used together). The current cache
+policy and settings of a cache LV can be displayed with the cache_policy
+and cache_settings reporting options:
-On an existing cache LV, the policy can be set (to "mq") and the cache settings
-can be changed using commands like these:
+.B lvs \-o+cache_policy,cache_settings VG/CacheLV
.I Example
-
.nf
-# lvchange \-\-cachepolicy mq vg/lv1
-# lvchange \-\-cachesettings \(aqmigration_threshold=2048 random_threshold=4\(aq \\
- vg/lv1
+Change the cache policy and settings of an existing cache LV.
+# lvchange \-\-cachepolicy mq \-\-cachesettings \\
+ \(aqmigration_threshold=2048 random_threshold=4\(aq vg/lv1
.fi
-Both commands can be combined, setting both cache policy and its settings
-together. Moreover, when creating a cache LV for the first time (using
-lvcreate), the \-\-cachepolicy and \-\-cachesettings parameters can be used as
-well. The current policy and the policy settings can be listed using the lvs
-command, using 'cache_policy' and 'cache_settings' fields:
+.BR lvm.conf (5)
+.B allocation/cache_policy
+.br
+defines the default cache policy.
+
+.BR lvm.conf (5)
+.B allocation/cache_settings
+.br
+defines the default cache settings.
-# lvs -o +cache_policy,cache_settings
.SS Spare metadata LV
7 years, 5 months