master - snapshot: zero cow header for read-only snapshot
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=2b044452e30acc...
Commit: 2b044452e30accf9ee026fc62ccea219bb4c7be4
Parent: 3bb9eda97c6ef2fb6848322e36b2b44a688ed37c
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Feb 26 00:17:11 2014 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Feb 26 00:22:46 2014 +0100
snapshot: zero cow header for read-only snapshot
When read-only snapshot was created, tool was skipping header
initialization of cow device. If it happened device has been
already containing header from some previous snapshot, it's
been 'reused' for a newly created snapshot instead of being cleared.
---
WHATS_NEW | 1 +
test/shell/snapshot-usage.sh | 11 +++++++++++
tools/lvcreate.c | 8 ++++++--
3 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index dd0821e..05218ee 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.106 -
====================================
+ Zero snapshot COW header when creating read-only snapshot.
Comment out config lines in dumpconfig output without default values defined.
Improve detection of clustered mirror support.
Enhance raid code with feature flags, for now checks for raid10.
diff --git a/test/shell/snapshot-usage.sh b/test/shell/snapshot-usage.sh
index fb88ae1..62a70e0 100644
--- a/test/shell/snapshot-usage.sh
+++ b/test/shell/snapshot-usage.sh
@@ -131,4 +131,15 @@ vgremove -ff $vg1
fi
+lvremove -f $vg
+
+# Check snapshot really deletes COW header for read-only snapshot
+aux lvmconf "allocation/wipe_signatures_when_zeroing_new_lvs = 1"
+lvcreate -L10 -n $lv1 $vg
+lvcreate -s -L10 -n snap $vg/$lv1
+# Populate snapshot with some filesystem signatures
+mkfs.ext4 "$DM_DEV_DIR/$vg/snap"
+lvremove -f $vg/snap
+lvcreate -s -pr -l12 -n snap $vg/$lv1
+
vgremove -ff $vg
diff --git a/tools/lvcreate.c b/tools/lvcreate.c
index dc473f8..ad00327 100644
--- a/tools/lvcreate.c
+++ b/tools/lvcreate.c
@@ -769,8 +769,12 @@ static int _read_activation_params(struct lvcreate_params *lp,
lp->permission = arg_uint_value(cmd, permission_ARG,
LVM_READ | LVM_WRITE);
- /* Must not zero/wipe read only volume */
- if (!(lp->permission & LVM_WRITE)) {
+ if (lp->snapshot) {
+ /* Snapshot has to zero COW header */
+ lp->zero = 1;
+ lp->wipe_signatures = 0;
+ } else if (!(lp->permission & LVM_WRITE)) {
+ /* Must not zero/wipe read only volume */
lp->zero = 0;
lp->wipe_signatures = 0;
}
10 years, 2 months
master - man: Enhancements to various man pages for cache[-pool] segtypes
by Jonathan Brassow
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=3bb9eda97c6ef2...
Commit: 3bb9eda97c6ef2fb6848322e36b2b44a688ed37c
Parent: f8bf4d7dfbd0ab44ec035bc61a286388a263fc48
Author: Jonathan Brassow <jbrassow(a)redhat.com>
AuthorDate: Tue Feb 25 12:17:03 2014 -0600
Committer: Jonathan Brassow <jbrassow(a)redhat.com>
CommitterDate: Tue Feb 25 12:17:03 2014 -0600
man: Enhancements to various man pages for cache[-pool] segtypes
Better formatting. More consistent naming. Better clarity.
---
man/lvconvert.8.in | 30 +++----
man/lvcreate.8.in | 33 ++++----
man/lvm.8.in | 256 ++++++++++++++++++++++++++++++----------------------
man/lvs.8.in | 2 +-
4 files changed, 179 insertions(+), 142 deletions(-)
diff --git a/man/lvconvert.8.in b/man/lvconvert.8.in
index c496d74..190e221 100644
--- a/man/lvconvert.8.in
+++ b/man/lvconvert.8.in
@@ -131,7 +131,7 @@ lvconvert \- convert a logical volume from linear to mirror or snapshot
.sp
.B lvconvert \-\-type cache
.RB \-\-cachepool
-.IR CachePoolLogicalVolume { Name | Path }
+.IR CachePoolLV { Name | Path }
.IR LogicalVolume [ Path ]
.RB [ \-h | \-? | \-\-help ]
.RB [ \-v | \-\-verbose ]
@@ -170,12 +170,9 @@ arguments is required.
.BR \-b ", " \-\-background
Run the daemon in the background.
.TP
-.BR \-\-cachepool " " \fCachePoolLogicalVolume
-This argument is used when converting a logical volume to a cached
-logical volume. The CachePoolLogicalVolume is the small and fast
-logical volume that will provide the cache for the large slow logical
-volume that is being converted. Not that a cache pool LV can only be
-used by one logical volume.
+.BR \-\-cachepool " " \fCachePoolLV
+This argument is necessary when converting a logical volume to a cache LV.
+For more information on cache pool LVs and cache LVs, see \fBlvm\fP(8).
.TP
.BR \-m ", " \-\-mirrors " " \fIMirrors
Specifies the degree of the mirror you wish to create.
@@ -208,8 +205,8 @@ uses this granularity to track which regions are in sync.
.TP
.B \-\-type \fISegmentType
Used to convert a logical volume to another segment type, like cache-pool,
-cache, raid1, mirror. When converting a logical volume to a cached logical
-volume, the \-\-cachepool argument is required.
+cache, raid1, or thin-pool. When converting a logical volume to a cache LV,
+the \-\-cachepool argument is required.
.TP
.BR \-i ", " \-\-interval " " \fISeconds
Report progress as a percentage at regular intervals.
@@ -478,16 +475,17 @@ For the read-only external origin use the new name "vg00/external".
.sp
.B lvconvert \-\-thinpool vg00/lvpool \-\-originname external -T vg00/origin
-Convert an existing logical volume to a cache pool logical volume using the
-given pool metadata LV.
+Convert an existing logical volume to a cache pool LV using the
+given cache metadata LV.
.sp
-.B lvconvert --type cache-pool vg00/my_lv_data \-\-poolmetadata vg00/my_lv_meta
-.B lvrename vg00/my_lv_data vg00/my_lv_cachepool
+.B lvconvert --type cache-pool --poolmetadata vg00/lvx_meta vg00/lvx_data
+.br
+.B lvrename vg00/lvx_data vg00/lvx_cachepool
-Convert an existing logical volume to a cached logical volume using the given
-cachepool.
+Convert an existing logical volume to a cache LV using the given
+cache pool LV.
.sp
-.B lvconvert \-\-type cache vg00/my_lv \-\-cachepool vg00/my_lv_cachepool
+.B lvconvert \-\-type cache \-\-cachepool vg00/lvx_cachepool vg00/lvx
.SH SEE ALSO
.BR lvm (8),
diff --git a/man/lvcreate.8.in b/man/lvcreate.8.in
index c449eb1..325baad 100644
--- a/man/lvcreate.8.in
+++ b/man/lvcreate.8.in
@@ -160,13 +160,14 @@ Ignore the flag to skip Logical Volumes during activation.
.TP
.BR \-\-cachemode " " { writeback | writethrough }
-Specifying a cache mode determines when the writes to a cached logical volume
-are considered complete. When "writeback" is specified, a write is considered
-complete as soon as it is stored in the cache pool (i.e. the smaller faster
-device). If "writethough" is specified, a write is considered complete only
-when it has been stored in the cache pool and on the origin (i.e. the larger
-slower device). While "writethrough" may be slower for writes, it is more
-resilient if something should happen to the cache pool device.
+Specifying a cache mode determines when the writes to a cache LV
+are considered complete. When \fIwriteback\fP is specified, a write is
+considered complete as soon as it is stored in the cache pool LV.
+If \fIwritethough\fP is specified, a write is considered complete only
+when it has been stored in the cache pool LV and on the origin LV.
+While \fIwritethrough\fP may be slower for writes, it is more
+resilient if something should happen to a device associated with the
+cache pool LV.
.TP
.BR \-c ", " \-\-chunksize " " \fIChunkSize [ \fIbBsSkKmMgG ]
@@ -176,7 +177,7 @@ Default unit is in kilobytes.
For snapshots the value must be power of 2 between 4KiB and 512KiB
and the default value is 4.
.br
-For cache pools the value must be between 32KiB and 1GiB. The default
+For cache pool LVs the value must be between 32KiB and 1GiB. The default
is 64KiB. Values must be a multiple of 32KiB.
.br
For thin pools the value must be between 64KiB and
@@ -415,7 +416,7 @@ as is the case with
or
.IR zero .
Note that the cache segment type requires a dm-cache kernel module version
-1.3.0 or greater or a kernel version 3.14 or newer.
+1.3.0 or greater.
.TP
.BR \-V ", " \-\-virtualsize " " \fIVirtualSize [ \fIbBsSkKmMgGtTpPeE ]
@@ -532,20 +533,20 @@ in vg00 that will use an existing thin pool "vg00/pool":
.sp
.B lvcreate -s --thinpool vg00/pool origin
-Create a cache pool logical volume that can later be used to cache one
+Create a cache pool LV that can later be used to cache one
logical volume.
.sp
.B lvcreate --type cache-pool -L 1G -n my_lv_cachepool vg /dev/fast1
-If there is an existing cache pool logical volume, create the large slow
-device (i.e. the origin) and link it to the supplied cache pool LV,
-creating a cache logical volume.
+If there is an existing cache pool LV, create the large slow
+device (i.e. the origin LV) and link it to the supplied cache pool LV,
+creating a cache LV.
.sp
.B lvcreate --type cache -L 100G -n my_lv vg/my_lv_cachepool /dev/slow1
-If there is an existing logical volume, create the fast and small
-cache pool logical volume and link it to the supplied existing logical
-volume (i.e. the origin), creating a cache logical volume.
+If there is an existing logical volume, create the small and fast
+cache pool LV and link it to the supplied existing logical
+volume (i.e. the origin LV), creating a cache LV.
.sp
.B lvcreate --type cache -L 1G -n my_lv_cachepool vg/my_lv /dev/fast1
diff --git a/man/lvm.8.in b/man/lvm.8.in
index 363f6af..39e47d3 100644
--- a/man/lvm.8.in
+++ b/man/lvm.8.in
@@ -390,156 +390,194 @@ To view the way the allocation process currently works in any specific
case, read the debug logging output, for example by adding \fB\-vvvv\fP to
a command.
-.SH ADVANCED LOGICAL VOLUME TYPES
+.SH LOGICAL VOLUME TYPES
Some logical volume types are simple to create and can be done with a
single \fBlvcreate\fP(8) command. The linear and striped logical
volume types are an example of this. Other logical volume types may
-require more than one command to create. The cache and thinly provisioned
-types are examples of this. This section is devoted to explaining the
-creation and monitoring of the more advanced types of logical volumes in
-LVM. While the specifics of each command can be found in their respective
-man page, here you will find examples and best practices that may invoke
-multiple commands.
+require more than one command to create. The cache and thin provisioning
+types are examples of this.
+
.br
-.SS Cache Logical Volumes
-A cache logical volume is one that allows a small and fast block device to
-be used to improve the performance of larger and slower block devices. It
-does this by storing the more frequently used blocks on the faster device.
-LVM refers to the small fast device as a "cache pool". The large slow device
-is called the "origin". Due to requirements from dm-cache (the kernel
-driver), LVM further splits the "cache pool" into two devices - the "cache pool
-metadata" and "cache pool data" devices. The "cache pool data" device is where
-copies of data blocks are kept from the origin to increase speed. The "cache
-pool metadata" device holds the accounting information that specifies where
-data blocks are stored (e.g. on the "origin" or in the "cache pool data" device).
-Users should be familiar with these three devices should they wish to create
-the best and most robust cached logical volumes.
-
-.SS Creating Cache Logical Volumes
-The steps to create a logical volume of cache type are as follows:
-.TP
-1)
-Create the cache pool's data device. The size of this device directly
-correlates to the size of the cache and will ultimately be reported as
-the size of the cache pool.
-.TP
-2)
-Create the cache pool's metadata device. The size of this device is
-loosely related to the size of the data device. Generally, a user can
-size this 1000 times smaller than the cache pool data device with a
-minimum size of 8MiB.
-.TP
-3)
-Create the cache pool by combining the cache pool data and metadata
-logical volumes created in steps 1 & 2. When performing this step,
-the user can specify behavioral characteristics of the cache pool if
-they wish. If no new name is specified when combining, the name of the
-cache pool data device will become the name of the cachepool. The sub-LVs
-are then renamed to <name>_cdata and <name>_cmeta.
-.TP
-4)
-Create a cached logical volume by linking the cache pool to an existing
-logical volume. The user accessible cached LV keeps the name of the origin,
-while the actual origin device becomes a hidden LV with the name
-<origial name>_corig. Users can perform this step while the device which
-is to be cached is in use.
+.SS Cache
+The \fIcache\fP logical volume type uses a small and fast LV to improve
+the performance of a large and slow LV. It does this by storing the
+frequently used blocks on the faster LV.
+LVM refers to the small fast LV as a \fBcache pool LV\fP. The large
+slow LV is called the \fBorigin LV\fP. Due to requirements from dm-cache
+(the kernel driver), LVM further splits the cache pool LV into two
+devices - the \fBcache data LV\fP and \fBcache metadata LV\fP. The cache
+data LV is where copies of data blocks are kept from the
+origin LV to increase speed. The cache metadata LV holds the
+accounting information that specifies where data blocks are stored (e.g.
+on the origin LV or on the cache data LV). Users should be familiar with
+these LVs if they wish to create the best and most robust cached
+logical volumes.
+
+.SS Cache Terms
+.nf
+origin LV OriginLV large slow LV
+cache data LV CacheDataLV small fast LV for cache pool data
+cache metadata LV CacheMetaLV small fast LV for cache pool metadata
+cache pool LV CachePoolLV CacheDataLV + CacheMetaLV
+cache LV CacheLV OriginLV + CachePoolLV
+.fi
+
+.SS Cache Steps
+The steps to create a logical volume of \fIcache\fP type are as follows:
+.TP
+0.
+Create an LV or identify an existing LV to be the origin LV.
+.TP
+1.
+Create the cache data LV. The size of this LV is the size of the cache
+and will be reported as the size of the cache pool LV.
+.TP
+2.
+Create the cache metadata LV.
+The size of this LV should be 1000 times smaller than the cache data LV
+with a minimum size of 8MiB.
+.TP
+3.
+Create the cache pool LV by combining the cache data LV (from step 1)
+and cache metadata LV (from step 2). When performing this step,
+behavioral characteristics of the cache pool LV can be set.
+The name of the cache pool LV takes the name of the cache data LV and
+the cache data LV and cache metadata LV are renamed
+to CachePoolLV_cdata and CachePoolLV_cmeta.
+.TP
+4.
+Create a cache LV by linking the cache pool LV to the origin LV.
+The user accessible cache LV takes the name of the origin LV,
+while the origin LV becomes a hidden LV with the name
+OriginLV_corig. Users can perform this step while the origin LV
+is in use.
.P
-The above steps represent the best way to create a cached logical volume.
-They provide access to the most options and have the ability to create the
-most robust logical volumes. The examples below will illustrate how these
+The steps above represent the best way to create a cache LV.
+They provide the most options and have the ability to create the
+most robust logical volumes. The examples below illustrate how these
steps might be used in practice.
+.SS Cache Commands
+.nf
+0. create OriginLV
+lvcreate -L LargeSize -n OriginLV VG SlowPVs
+
+1. create CacheDataLV
+lvcreate -L CacheSize -n CacheDataLV VG FastPVs
+
+2. create CacheMetaLV
+lvcreate -L MetaSize -n CacheMetaLV VG FastPVs
+
+3. create CachePoolLV
+lvconvert --type cache-pool --poolmetadata VG/CacheMetaLV VG/CacheDataLV
+CachePoolLV takes the name of CacheDataLV.
+CacheDataLV is renamed CachePoolLV_cdata and becomes hidden.
+CacheMetaLV is renamed CachePoolLV_cmeta and becomes hidden.
+
+4. create CacheLV
+lvconvert --type cache --cachepool VG/CachePoolLV VG/OriginLV
+CacheLV takes the name of OriginLV.
+OriginLV is renamed OriginLV_corig and becomes hidden.
+.fi
+
+.SS Cache Examples
+
.B Example 1:
-Creating a simple cache device named, "my_lv".
+Creating a simple cache LV.
.br
.nf
-# Create a device we wish to cache (yours may already exist)
-Step-0> lvcreate -L 10G -n my_lv my_vg /dev/slow_dev
+0. Create the origin LV
+# lvcreate -L 10G -n lvx vg /dev/slow_dev
-# Create a cache pool data LV
-Step-1> lvcreate -L 1G -n cachepool my_vg /dev/fast_dev
+1. Create a cache data LV
+# lvcreate -L 1G -n lvx_cache vg /dev/fast_dev
-# Create a cache pool metadata LV (~1/1000th size of pool data)
-Step-2> lvcreate -L 8M -n meta my_vg /dev/fast_dev
+2. Create a cache metadata LV (~1/1000th size of CacheDataLV or 8MiB)
+# lvcreate -L 8M -n lvx_cache_meta vg /dev/fast_dev
-# Combine cache pool sub-LVs into a cache pool.
-Step-3> lvconvert --type cache-pool vg/cachepool --poolmetadata vg/meta
+3. Create a cache pool LV, combining cache data LV and cache metadata LV
+# lvconvert --type cache-pool --poolmetadata vg/lvx_cache_meta \\
+ vg/lvx_cache
-# Combine the cache pool and origin to create a cached LV
-Step-4> lvconvert --type cache my_vg/my_lv --cachepool vg/cachepool
+4. Create a cached LV by combining the cache pool LV and origin LV
+# lvconvert --type cache --cachepool vg/lvx_cache vg/lvx
.fi
+.B Example 2:
+Creating a cache LV with a fault tolerant cache pool LV.
+
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. Example 2 illustrates how to do just that. Note that only steps
-1 & 2 change slightly.
-
-.B Example 2:
-Creating a cache LV with a fault tolerant cache pool.
+redundant. Example 2 illustrates how to do that. Note that only steps
+1 & 2 change.
.nf
-# Create a device we wish to cache (yours may already exist)
-Step-0> lvcreate -L 10G -n my_lv my_vg /dev/slow_dev
+0. Create an origin LV we wish to cache
+# lvcreate -L 10G -n lvx vg /dev/slow_devs
-# Create a 2-way RAID1 cache pool data LV
-Step-01> lvcreate --type raid1 -L 1G -n cachepool my_vg /dev/fast[12]
+1. Create a 2-way RAID1 cache data LV
+# lvcreate --type raid1 -m 1 -L 1G -n lvx_cache vg \\
+ /dev/fast1 /dev/fast2
-# Create a 2-way RAID1 cache pool metadata LV
-Step-2> lvcreate --type raid1 -L 8M -n meta my_vg /dev/fast1 /dev/fast2
+2. Create a 2-way RAID1 cache metadata LV
+# lvcreate --type raid1 -m 1 -L 8M -n lvx_cache_meta vg \\
+ /dev/fast1 /dev/fast2
-# Combine cache pool sub-LVs into a cache pool.
-Step-3> lvconvert --type cache-pool vg/cachepool --poolmetadata vg/meta
+3. Create a cache pool LV combining cache data LV and cache metadata LV
+# lvconvert --type cache-pool --poolmetadata vg/lvx_cache_meta \\
+ vg/lvx_cache
-# Combine the cache pool and origin to create a cached LV
-Step-4> lvconvert --type cache my_vg/my_lv --cachepool vg/cachepool
+4. Create a cached LV by combining the cache pool LV and origin LV
+# lvconvert --type cache --cachepool vg/lvx_cache vg/lvx
.fi
-Some users wish to ensure that any data written will be stored both in the
-cache pool and on the origin. The loss of the cache device in this case
-would not mean the loss of any data. When combining the cache pool's sub-LVs
-to form the cachepool, behavioral characteristics of the cache can be
-specified - in this case, writethrough vs. writeback. Note that only step
-3 is affected in this case.
-
.B Example 3:
-Creating a simple cache device with "writethough" caching.
+Creating a simple cache LV with \fIwritethough\fP caching.
+
+Some users wish to ensure that any data written will be stored both in the
+cache pool LV and on the origin LV. The loss of a device associated with
+the cache pool LV in this case would not mean the loss of any data. When
+combining the cache data LV and the cache metadata LV to form the cache pool
+LV, properties of the cache can be specified - in this case,
+\fIwritethrough\fP vs. \fIwriteback\fP. Note that only step 3 is affected
+in this case.
.nf
-# Create a device we wish to cache (yours may already exist)
-Step-0> lvcreate -L 10G -n my_lv my_vg /dev/slow_dev
+0. Create an origin LV we wish to cache (yours may already exist)
+# lvcreate -L 10G -n lvx vg /dev/slow
-# Create a cache pool data LV
-Step-1> lvcreate -L 1G -n cachepool my_vg /dev/fast_dev
+1. Create a cache data LV
+# lvcreate -L 1G -n lvx_cache vg /dev/fast
-# Create a cache pool metadata LV
-Step-2> lvcreate -L 8M -n meta my_vg /dev/fast_dev
+2. Create a cache metadata LV
+# lvcreate -L 8M -n lvx_cache_meta vg /dev/fast
-# Combine cache pool sub-LVs into a cache pool and specify "writethough".
-Step-3> lvconvert --type cache-pool vg/cachepool \\
- --poolmetadata vg/meta --cachemode writethrough -n cachepool
+3. Create a cache pool LV specifying cache mode "writethrough"
+# lvconvert --type cache-pool --poolmetadata vg/lvx_cache_meta \\
+ --cachemode writethrough vg/lvx_cache
-# Combine the cache pool and origin to create a cached LV
-Step-4> lvconvert --type cache my_vg/my_lv --cachepool vg/cachepool
+4. Create a cache LV by combining the cache pool LV and origin LV
+# lvconvert --type cache --cachepool vg/lvx_cache vg/lvx
.fi
.SS Removing Cache Logical Volumes
-If users wish to remove all logical volumes associated with a cached
-logical volume, they must remove both top-level, user visible devices.
-The cache pool metadata and data logical volumes cannot be removed
-directly. If only the cache pool is specfied for removal, any cached
-blocks not yet on the origin will be flush, the cache pool will be
-removed, and the now un-cached origin will remain. If the user
-specifies a cached LV for removal, then the origin device is
-removed and only the cache pool will remain. The cache pool can then be
-used to create another cache LV with a different origin if desired.
+If you wish to remove all logical volumes associated with a cache
+LV, you must remove both top-level, user-visible devices.
+The cache metadata LV and cache data LV cannot be removed
+directly. If only the cache pool LV is specfied for removal, any cached
+blocks not yet on the origin LV will be flush, the cache pool LV will be
+removed, and the now un-cached origin LV will remain. If the user
+specifies a cache LV for removal, then the origin LV is
+removed and only the cache pool LV will remain. The cache pool LV can then
+be used to create another cache LV with a different origin LV if desired.
When users intend to remove all logical volumes associated with a
-cached LV, it is generally better to start with the origin and then
-remove the cache pool. If the operations are performed in the
+cache LV, it is generally better to start with the origin LV and then
+remove the cache pool LV. If the operations are performed in the
reverse order, the user will have to wait for the contents of the
-cache pool to be flushed before they remove the origin. This
+cache pool LV to be flushed before the origin LV is removed. This
could take some time.
.SH DIAGNOSTICS
diff --git a/man/lvs.8.in b/man/lvs.8.in
index 5c76cf1..95eb25a 100644
--- a/man/lvs.8.in
+++ b/man/lvs.8.in
@@ -135,7 +135,7 @@ can also be chosen.
The lv_attr bits are:
.RS
.IP 1 3
-Volume type: (C)ached, (m)irrored, (M)irrored without initial sync, (o)rigin,
+Volume type: (C)ache, (m)irrored, (M)irrored without initial sync, (o)rigin,
(O)rigin with merging snapshot, (r)aid, (R)aid without initial sync,
(s)napshot, merging (S)napshot, (p)vmove, (v)irtual,
mirror or raid (i)mage, mirror or raid (I)mage out-of-sync, mirror (l)og device,
10 years, 2 months
master - dumpconfig: add a comment to each config with variable name, use '<name>' to denote that for config paths
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=f8bf4d7dfbd0ab...
Commit: f8bf4d7dfbd0ab44ec035bc61a286388a263fc48
Parent: 558c932444fb4058e1db99147b286bfed72e94d0
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Tue Feb 25 11:08:00 2014 +0100
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Tue Feb 25 11:32:54 2014 +0100
dumpconfig: add a comment to each config with variable name, use '<name>' to denote that for config paths
Just to make the dumpconfig output (the comments) more readable
when we hit configuration lines that have variable names (e.g. tags).
---
lib/config/config.c | 21 ++++++++++++++-------
1 files changed, 14 insertions(+), 7 deletions(-)
diff --git a/lib/config/config.c b/lib/config/config.c
index 69e357b..e51c26f 100644
--- a/lib/config/config.c
+++ b/lib/config/config.c
@@ -477,20 +477,24 @@ time_t config_file_timestamp(struct dm_config_tree *cft)
#define cfg_def_get_item_p(id) (&_cfg_def_items[id])
#define cfg_def_get_default_value(item,type) item->default_value.v_##type
-#define cfg_def_get_path(item) (_cfg_def_make_path(_cfg_path,CFG_PATH_MAX_LEN,item->id,item),_cfg_path)
+#define cfg_def_get_path(item) (_cfg_def_make_path(_cfg_path,CFG_PATH_MAX_LEN,item->id,item, 0),_cfg_path)
+#define cfg_def_get_path_xlated(item) (_cfg_def_make_path(_cfg_path,CFG_PATH_MAX_LEN,item->id,item, 1),_cfg_path)
-static int _cfg_def_make_path(char *buf, size_t buf_size, int id, cfg_def_item_t *item)
+static int _cfg_def_make_path(char *buf, size_t buf_size, int id, cfg_def_item_t *item, int xlate)
{
+ int variable = item->flags & CFG_NAME_VARIABLE;
int parent_id = item->parent;
int count, n;
if (id == parent_id)
return 0;
- count = _cfg_def_make_path(buf, buf_size, parent_id, cfg_def_get_item_p(parent_id));
- if ((n = dm_snprintf(buf + count, buf_size - count, "%s%s",
+ count = _cfg_def_make_path(buf, buf_size, parent_id, cfg_def_get_item_p(parent_id), xlate);
+ if ((n = dm_snprintf(buf + count, buf_size - count, "%s%s%s%s",
count ? "/" : "",
- item->flags & CFG_NAME_VARIABLE ? "#" : item->name)) < 0) {
+ xlate && variable ? "<" : "",
+ !xlate && variable ? "#" : item->name,
+ xlate && variable ? ">" : "")) < 0) {
log_error(INTERNAL_ERROR "_cfg_def_make_path: supplied buffer too small for %s/%s",
cfg_def_get_item_p(parent_id)->name, item->name);
buf[0] = '\0';
@@ -502,7 +506,7 @@ static int _cfg_def_make_path(char *buf, size_t buf_size, int id, cfg_def_item_t
int config_def_get_path(char *buf, size_t buf_size, int id)
{
- return _cfg_def_make_path(buf, buf_size, id, cfg_def_get_item_p(id));
+ return _cfg_def_make_path(buf, buf_size, id, cfg_def_get_item_p(id), 0);
}
static void _get_type_name(char *buf, size_t buf_size, cfg_def_type_t type)
@@ -1108,7 +1112,7 @@ static int _out_prefix_fn(const struct dm_config_node *cn, const char *line, voi
cfg_def = cfg_def_get_item_p(cn->id);
if (out->tree_spec->withcomments) {
- path = cfg_def_get_path(cfg_def);
+ path = cfg_def_get_path_xlated(cfg_def);
fprintf(out->fp, "%s# Configuration %s %s.\n", line, node_type_name, path);
if (cfg_def->comment)
@@ -1120,6 +1124,9 @@ static int _out_prefix_fn(const struct dm_config_node *cn, const char *line, voi
if (cfg_def->flags & CFG_UNSUPPORTED)
fprintf(out->fp, "%s# This configuration %s is not officially supported.\n", line, node_type_name);
+ if (cfg_def->flags & CFG_NAME_VARIABLE)
+ fprintf(out->fp, "%s# This configuration %s has variable name.\n", line, node_type_name);
+
if (cfg_def->flags & CFG_DEFAULT_UNDEFINED)
fprintf(out->fp, "%s# This configuration %s does not have a default value defined.\n", line, node_type_name);
}
10 years, 2 months
master - dumpconfig: comment out config lines without default values defined
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=558c932444fb40...
Commit: 558c932444fb4058e1db99147b286bfed72e94d0
Parent: d0b5e51d29d5d1c03b3fd561ced3755383d5f4c3
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Tue Feb 25 11:05:23 2014 +0100
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Tue Feb 25 11:32:54 2014 +0100
dumpconfig: comment out config lines without default values defined
To make "lvm dumpconfig --type default" output to be usable like any
other config, we need to comment out lines that have no default value
defined. Otherwise, we'd have the output with config options
with blank or zero values which is not the same as when the value
is not defined! And such configuration can't be feed into lvm again
without further edits. So let's fix this.
Currently this covers these configuration options exactly:
devices/loopfiles
devices/preferred_names
devices/filter
devices/global_filter
devices/types
allocation/cling_tag_list
global/format_libraries
global/segment_libraries
activation/volume_list
activation/auto_activation_volume_list
activation/read_only_volume_list
activation/mlock_filter
metadata/dirs
metadata/disk_areas
metadata/disk_areas/<disk_area>
metadata/disk_areas/<disk_area>/start_sector
metadata/disk_areas/<disk_area>/size
metadata/disk_areas/<disk_area>/id
tags/<tag>
tags/<tag>/host_list
---
WHATS_NEW | 1 +
lib/config/config.c | 20 ++++++++++++--------
lib/config/config.h | 11 +++++++----
lib/config/config_settings.h | 41 +++++++++++++++++++++--------------------
tools/dumpconfig.c | 10 +++++++---
5 files changed, 48 insertions(+), 35 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 005a321..dd0821e 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.106 -
====================================
+ Comment out config lines in dumpconfig output without default values defined.
Improve detection of clustered mirror support.
Enhance raid code with feature flags, for now checks for raid10.
Move parsing of VG metadata from vg_commit() back to vg_write() (2.02.99)
diff --git a/lib/config/config.c b/lib/config/config.c
index 6e93c40..69e357b 100644
--- a/lib/config/config.c
+++ b/lib/config/config.c
@@ -1086,8 +1086,7 @@ int merge_config_tree(struct cmd_context *cmd, struct dm_config_tree *cft,
struct out_baton {
FILE *fp;
- int withcomment;
- int withversion;
+ struct config_def_tree_spec *tree_spec;
};
static int _out_prefix_fn(const struct dm_config_node *cn, const char *line, void *baton)
@@ -1108,7 +1107,7 @@ static int _out_prefix_fn(const struct dm_config_node *cn, const char *line, voi
cfg_def = cfg_def_get_item_p(cn->id);
- if (out->withcomment) {
+ if (out->tree_spec->withcomments) {
path = cfg_def_get_path(cfg_def);
fprintf(out->fp, "%s# Configuration %s %s.\n", line, node_type_name, path);
@@ -1120,9 +1119,12 @@ static int _out_prefix_fn(const struct dm_config_node *cn, const char *line, voi
if (cfg_def->flags & CFG_UNSUPPORTED)
fprintf(out->fp, "%s# This configuration %s is not officially supported.\n", line, node_type_name);
+
+ if (cfg_def->flags & CFG_DEFAULT_UNDEFINED)
+ fprintf(out->fp, "%s# This configuration %s does not have a default value defined.\n", line, node_type_name);
}
- if (out->withversion) {
+ if (out->tree_spec->withversions) {
if (dm_snprintf(version, 9, "%u.%u.%u",
(cfg_def->since_version & 0xE000) >> 13,
(cfg_def->since_version & 0x1E00) >> 9,
@@ -1139,7 +1141,10 @@ static int _out_prefix_fn(const struct dm_config_node *cn, const char *line, voi
static int _out_line_fn(const struct dm_config_node *cn, const char *line, void *baton)
{
struct out_baton *out = baton;
- fprintf(out->fp, "%s\n", line);
+ struct cfg_def_item *cfg_def = cfg_def_get_item_p(cn->id);
+
+ fprintf(out->fp, "%s%s\n", (out->tree_spec->type != CFG_DEF_TREE_CURRENT) &&
+ (cfg_def->flags & CFG_DEFAULT_UNDEFINED) ? "#" : "", line);
return 1;
}
@@ -1149,7 +1154,7 @@ static int _out_suffix_fn(const struct dm_config_node *cn, const char *line, voi
}
int config_write(struct dm_config_tree *cft,
- int withcomment, int withversion,
+ struct config_def_tree_spec *tree_spec,
const char *file, int argc, char **argv)
{
static const struct dm_config_node_out_spec _out_spec = {
@@ -1159,8 +1164,7 @@ int config_write(struct dm_config_tree *cft,
};
const struct dm_config_node *cn;
struct out_baton baton = {
- .withcomment = withcomment,
- .withversion = withversion
+ .tree_spec = tree_spec
};
int r = 1;
diff --git a/lib/config/config.h b/lib/config/config.h
index 0769c40..f716efb 100644
--- a/lib/config/config.h
+++ b/lib/config/config.h
@@ -82,6 +82,8 @@ typedef union {
#define CFG_UNSUPPORTED 0x08
/* whether the configuration item is customizable by a profile */
#define CFG_PROFILABLE 0x10
+/* whether the default value is undefned */
+#define CFG_DEFAULT_UNDEFINED 0x20
/* configuration definition item structure */
typedef struct cfg_def_item {
@@ -109,8 +111,10 @@ typedef enum {
struct config_def_tree_spec {
cfg_def_tree_t type; /* tree type */
uint16_t version; /* tree at this LVM2 version */
- int ignoreadvanced; /* do not include advanced configs */
- int ignoreunsupported; /* do not include unsupported configs */
+ int ignoreadvanced:1; /* do not include advanced configs */
+ int ignoreunsupported:1; /* do not include unsupported configs */
+ int withcomments:1; /* include comments */
+ int withversions:1; /* include versions */
uint8_t *check_status; /* status of last tree check (currently needed for CFG_DEF_TREE_MISSING only) */
};
@@ -163,8 +167,7 @@ int config_file_read_fd(struct dm_config_tree *cft, struct device *dev,
checksum_fn_t checksum_fn, uint32_t checksum);
int config_file_read(struct dm_config_tree *cft);
struct dm_config_tree *config_file_open_and_read(const char *config_file, config_source_t source);
-int config_write(struct dm_config_tree *cft,
- int withcomment, int withversion,
+int config_write(struct dm_config_tree *cft, struct config_def_tree_spec *tree_spec,
const char *file, int argc, char **argv);
struct dm_config_tree *config_def_create_tree(struct config_def_tree_spec *spec);
void config_destroy(struct dm_config_tree *cft);
diff --git a/lib/config/config_settings.h b/lib/config/config_settings.h
index f1900b8..32ca0cf 100644
--- a/lib/config/config_settings.h
+++ b/lib/config/config_settings.h
@@ -32,6 +32,7 @@
* CFG_ADVANCED - this node belongs to advanced config set
* CFG_UNSUPPORTED - this node belongs to unsupported config set
* CFG_PROFILABLE - this node is customizable by a profile
+ * CFG_DEFAULT_UNDEFINED - node's default value is undefined
* type: allowed type for the value of simple configuation setting, one of:
* CFG_TYPE_BOOL
* CFG_TYPE_INT
@@ -77,16 +78,16 @@ cfg(config_profile_dir_CFG, "profile_dir", config_CFG_SECTION, 0, CFG_TYPE_STRIN
cfg(devices_dir_CFG, "dir", devices_CFG_SECTION, 0, CFG_TYPE_STRING, DEFAULT_DEV_DIR, vsn(1, 0, 0), NULL)
cfg_array(devices_scan_CFG, "scan", devices_CFG_SECTION, 0, CFG_TYPE_STRING, "#S/dev", vsn(1, 0, 0), NULL)
-cfg_array(devices_loopfiles_CFG, "loopfiles", devices_CFG_SECTION, 0, CFG_TYPE_STRING, NULL, vsn(1, 2, 0), NULL)
+cfg_array(devices_loopfiles_CFG, "loopfiles", devices_CFG_SECTION, CFG_DEFAULT_UNDEFINED, CFG_TYPE_STRING, NULL, vsn(1, 2, 0), NULL)
cfg(devices_obtain_device_list_from_udev_CFG, "obtain_device_list_from_udev", devices_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_OBTAIN_DEVICE_LIST_FROM_UDEV, vsn(2, 2, 85), NULL)
-cfg_array(devices_preferred_names_CFG, "preferred_names", devices_CFG_SECTION, CFG_ALLOW_EMPTY, CFG_TYPE_STRING, NULL, vsn(1, 2, 19), NULL)
-cfg_array(devices_filter_CFG, "filter", devices_CFG_SECTION, 0, CFG_TYPE_STRING, NULL, vsn(1, 0, 0), NULL)
-cfg_array(devices_global_filter_CFG, "global_filter", devices_CFG_SECTION, 0, CFG_TYPE_STRING, NULL, vsn(2, 2, 98), NULL)
+cfg_array(devices_preferred_names_CFG, "preferred_names", devices_CFG_SECTION, CFG_ALLOW_EMPTY | CFG_DEFAULT_UNDEFINED, CFG_TYPE_STRING, NULL, vsn(1, 2, 19), NULL)
+cfg_array(devices_filter_CFG, "filter", devices_CFG_SECTION, CFG_DEFAULT_UNDEFINED, CFG_TYPE_STRING, NULL, vsn(1, 0, 0), NULL)
+cfg_array(devices_global_filter_CFG, "global_filter", devices_CFG_SECTION, CFG_DEFAULT_UNDEFINED, CFG_TYPE_STRING, NULL, vsn(2, 2, 98), NULL)
cfg(devices_cache_CFG, "cache", devices_CFG_SECTION, 0, CFG_TYPE_STRING, NULL, vsn(1, 0, 0), NULL)
cfg(devices_cache_dir_CFG, "cache_dir", devices_CFG_SECTION, 0, CFG_TYPE_STRING, NULL, vsn(1, 2, 19), NULL)
cfg(devices_cache_file_prefix_CFG, "cache_file_prefix", devices_CFG_SECTION, 0, CFG_TYPE_STRING, NULL, vsn(1, 2, 19), NULL)
cfg(devices_write_cache_state_CFG, "write_cache_state", devices_CFG_SECTION, 0, CFG_TYPE_BOOL, 1, vsn(1, 0, 0), NULL)
-cfg_array(devices_types_CFG, "types", devices_CFG_SECTION, 0, CFG_TYPE_INT | CFG_TYPE_STRING, NULL, vsn(1, 0, 0), NULL)
+cfg_array(devices_types_CFG, "types", devices_CFG_SECTION, CFG_DEFAULT_UNDEFINED, CFG_TYPE_INT | CFG_TYPE_STRING, NULL, vsn(1, 0, 0), NULL)
cfg(devices_sysfs_scan_CFG, "sysfs_scan", devices_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_SYSFS_SCAN, vsn(1, 0, 8), NULL)
cfg(devices_multipath_component_detection_CFG, "multipath_component_detection", devices_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_MULTIPATH_COMPONENT_DETECTION, vsn(2, 2, 89), NULL)
cfg(devices_md_component_detection_CFG, "md_component_detection", devices_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_MD_COMPONENT_DETECTION, vsn(1, 0, 18), NULL)
@@ -102,7 +103,7 @@ cfg(devices_require_restorefile_with_uuid_CFG, "require_restorefile_with_uuid",
cfg(devices_pv_min_size_CFG, "pv_min_size", devices_CFG_SECTION, 0, CFG_TYPE_INT, DEFAULT_PV_MIN_SIZE_KB, vsn(2, 2, 85), NULL)
cfg(devices_issue_discards_CFG, "issue_discards", devices_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_ISSUE_DISCARDS, vsn(2, 2, 85), NULL)
-cfg_array(allocation_cling_tag_list_CFG, "cling_tag_list", allocation_CFG_SECTION, 0, CFG_TYPE_STRING, NULL, vsn(2, 2, 77), NULL)
+cfg_array(allocation_cling_tag_list_CFG, "cling_tag_list", allocation_CFG_SECTION, CFG_DEFAULT_UNDEFINED, CFG_TYPE_STRING, NULL, vsn(2, 2, 77), NULL)
cfg(allocation_maximise_cling_CFG, "maximise_cling", allocation_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_MAXIMISE_CLING, vsn(2, 2, 85), NULL)
cfg(allocation_use_blkid_wiping_CFG, "use_blkid_wiping", allocation_CFG_SECTION, 0, CFG_TYPE_BOOL, 1, vsn(2, 2, 105), NULL)
cfg(allocation_wipe_signatures_when_zeroing_new_lvs_CFG, "wipe_signatures_when_zeroing_new_lvs", allocation_CFG_SECTION, 0, CFG_TYPE_BOOL, 1, vsn(2, 2, 105), NULL)
@@ -148,8 +149,8 @@ cfg(global_activation_CFG, "activation", global_CFG_SECTION, 0, CFG_TYPE_BOOL, D
cfg(global_suffix_CFG, "suffix", global_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_SUFFIX, vsn(1, 0, 0), NULL)
cfg(global_fallback_to_lvm1_CFG, "fallback_to_lvm1", global_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_FALLBACK_TO_LVM1, vsn(1, 0, 18), NULL)
cfg(global_format_CFG, "format", global_CFG_SECTION, 0, CFG_TYPE_STRING, DEFAULT_FORMAT, vsn(1, 0, 0), NULL)
-cfg_array(global_format_libraries_CFG, "format_libraries", global_CFG_SECTION, 0, CFG_TYPE_STRING, NULL, vsn(1, 0, 0), NULL)
-cfg_array(global_segment_libraries_CFG, "segment_libraries", global_CFG_SECTION, 0, CFG_TYPE_STRING, NULL, vsn(1, 0, 18), NULL)
+cfg_array(global_format_libraries_CFG, "format_libraries", global_CFG_SECTION, CFG_DEFAULT_UNDEFINED, CFG_TYPE_STRING, NULL, vsn(1, 0, 0), NULL)
+cfg_array(global_segment_libraries_CFG, "segment_libraries", global_CFG_SECTION, CFG_DEFAULT_UNDEFINED, CFG_TYPE_STRING, NULL, vsn(1, 0, 18), NULL)
cfg(global_proc_CFG, "proc", global_CFG_SECTION, 0, CFG_TYPE_STRING, DEFAULT_PROC_DIR, vsn(1, 0, 0), NULL)
cfg(global_locking_type_CFG, "locking_type", global_CFG_SECTION, 0, CFG_TYPE_INT, 1, vsn(1, 0, 0), NULL)
cfg(global_wait_for_locks_CFG, "wait_for_locks", global_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_WAIT_FOR_LOCKS, vsn(2, 2, 50), NULL)
@@ -183,9 +184,9 @@ cfg(activation_use_linear_target_CFG, "use_linear_target", activation_CFG_SECTIO
cfg(activation_reserved_stack_CFG, "reserved_stack", activation_CFG_SECTION, 0, CFG_TYPE_INT, DEFAULT_RESERVED_STACK, vsn(1, 0, 0), NULL)
cfg(activation_reserved_memory_CFG, "reserved_memory", activation_CFG_SECTION, 0, CFG_TYPE_INT, DEFAULT_RESERVED_MEMORY, vsn(1, 0, 0), NULL)
cfg(activation_process_priority_CFG, "process_priority", activation_CFG_SECTION, 0, CFG_TYPE_INT, DEFAULT_PROCESS_PRIORITY, vsn(1, 0, 0), NULL)
-cfg_array(activation_volume_list_CFG, "volume_list", activation_CFG_SECTION, CFG_ALLOW_EMPTY, CFG_TYPE_STRING, NULL, vsn(1, 0, 18), NULL)
-cfg_array(activation_auto_activation_volume_list_CFG, "auto_activation_volume_list", activation_CFG_SECTION, CFG_ALLOW_EMPTY, CFG_TYPE_STRING, NULL, vsn(2, 2, 97), NULL)
-cfg_array(activation_read_only_volume_list_CFG, "read_only_volume_list", activation_CFG_SECTION, CFG_ALLOW_EMPTY, CFG_TYPE_STRING, NULL, vsn(2, 2, 89), NULL)
+cfg_array(activation_volume_list_CFG, "volume_list", activation_CFG_SECTION, CFG_ALLOW_EMPTY|CFG_DEFAULT_UNDEFINED, CFG_TYPE_STRING, NULL, vsn(1, 0, 18), NULL)
+cfg_array(activation_auto_activation_volume_list_CFG, "auto_activation_volume_list", activation_CFG_SECTION, CFG_ALLOW_EMPTY | CFG_DEFAULT_UNDEFINED, CFG_TYPE_STRING, NULL, vsn(2, 2, 97), NULL)
+cfg_array(activation_read_only_volume_list_CFG, "read_only_volume_list", activation_CFG_SECTION, CFG_ALLOW_EMPTY | CFG_DEFAULT_UNDEFINED, CFG_TYPE_STRING, NULL, vsn(2, 2, 89), NULL)
cfg(activation_mirror_region_size_CFG, "mirror_region_size", activation_CFG_SECTION, 0, CFG_TYPE_INT, DEFAULT_RAID_REGION_SIZE, vsn(1, 0, 0), NULL)
cfg(activation_raid_region_size_CFG, "raid_region_size", activation_CFG_SECTION, 0, CFG_TYPE_INT, DEFAULT_RAID_REGION_SIZE, vsn(2, 2, 99), NULL)
cfg(activation_readahead_CFG, "readahead", activation_CFG_SECTION, 0, CFG_TYPE_STRING, DEFAULT_READ_AHEAD, vsn(1, 0, 23), NULL)
@@ -197,7 +198,7 @@ cfg(activation_snapshot_autoextend_threshold_CFG, "snapshot_autoextend_threshold
cfg(activation_snapshot_autoextend_percent_CFG, "snapshot_autoextend_percent", activation_CFG_SECTION, 0, CFG_TYPE_INT, DEFAULT_SNAPSHOT_AUTOEXTEND_PERCENT, vsn(2, 2, 75), NULL)
cfg(activation_thin_pool_autoextend_threshold_CFG, "thin_pool_autoextend_threshold", activation_CFG_SECTION, CFG_PROFILABLE, CFG_TYPE_INT, DEFAULT_THIN_POOL_AUTOEXTEND_THRESHOLD, vsn(2, 2, 89), NULL)
cfg(activation_thin_pool_autoextend_percent_CFG, "thin_pool_autoextend_percent", activation_CFG_SECTION, CFG_PROFILABLE, CFG_TYPE_INT, DEFAULT_THIN_POOL_AUTOEXTEND_PERCENT, vsn(2, 2, 89), NULL)
-cfg_array(activation_mlock_filter_CFG, "mlock_filter", activation_CFG_SECTION, 0, CFG_TYPE_STRING, NULL, vsn(2, 2, 62), NULL)
+cfg_array(activation_mlock_filter_CFG, "mlock_filter", activation_CFG_SECTION, CFG_DEFAULT_UNDEFINED, CFG_TYPE_STRING, NULL, vsn(2, 2, 62), NULL)
cfg(activation_use_mlockall_CFG, "use_mlockall", activation_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_USE_MLOCKALL, vsn(2, 2, 62), NULL)
cfg(activation_monitoring_CFG, "monitoring", activation_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_DMEVENTD_MONITOR, vsn(2, 2, 63), NULL)
cfg(activation_polling_interval_CFG, "polling_interval", activation_CFG_SECTION, 0, CFG_TYPE_INT, DEFAULT_INTERVAL, vsn(2, 2, 63), NULL)
@@ -208,13 +209,13 @@ cfg(metadata_vgmetadatacopies_CFG, "vgmetadatacopies", metadata_CFG_SECTION, CFG
cfg(metadata_pvmetadatasize_CFG, "pvmetadatasize", metadata_CFG_SECTION, CFG_ADVANCED, CFG_TYPE_INT, DEFAULT_PVMETADATASIZE, vsn(1, 0, 0), NULL)
cfg(metadata_pvmetadataignore_CFG, "pvmetadataignore", metadata_CFG_SECTION, CFG_ADVANCED, CFG_TYPE_BOOL, DEFAULT_PVMETADATAIGNORE, vsn(2, 2, 69), NULL)
cfg(metadata_stripesize_CFG, "stripesize", metadata_CFG_SECTION, CFG_ADVANCED, CFG_TYPE_INT, DEFAULT_STRIPESIZE, vsn(1, 0, 0), NULL)
-cfg_array(metadata_dirs_CFG, "dirs", metadata_CFG_SECTION, CFG_ADVANCED, CFG_TYPE_STRING, NULL, vsn(1, 0, 0), NULL)
+cfg_array(metadata_dirs_CFG, "dirs", metadata_CFG_SECTION, CFG_ADVANCED | CFG_DEFAULT_UNDEFINED, CFG_TYPE_STRING, NULL, vsn(1, 0, 0), NULL)
-cfg_section(metadata_disk_areas_CFG_SUBSECTION, "disk_areas", metadata_CFG_SECTION, CFG_ADVANCED | CFG_UNSUPPORTED, vsn(1, 0, 0), NULL)
-cfg_section(disk_area_CFG_SUBSECTION, "disk_area", metadata_disk_areas_CFG_SUBSECTION, CFG_NAME_VARIABLE | CFG_ADVANCED | CFG_UNSUPPORTED, vsn(1, 0, 0), NULL)
-cfg(disk_area_start_sector_CFG, "start_sector", disk_area_CFG_SUBSECTION, CFG_ADVANCED | CFG_UNSUPPORTED, CFG_TYPE_INT, 0, vsn(1, 0, 0), NULL)
-cfg(disk_area_size_CFG, "size", disk_area_CFG_SUBSECTION, CFG_ADVANCED | CFG_UNSUPPORTED, CFG_TYPE_INT, 0, vsn(1, 0, 0), NULL)
-cfg(disk_area_id_CFG, "id", disk_area_CFG_SUBSECTION, CFG_ADVANCED | CFG_UNSUPPORTED, CFG_TYPE_STRING, NULL, vsn(1, 0, 0), NULL)
+cfg_section(metadata_disk_areas_CFG_SUBSECTION, "disk_areas", metadata_CFG_SECTION, CFG_ADVANCED | CFG_UNSUPPORTED | CFG_DEFAULT_UNDEFINED, vsn(1, 0, 0), NULL)
+cfg_section(disk_area_CFG_SUBSECTION, "disk_area", metadata_disk_areas_CFG_SUBSECTION, CFG_NAME_VARIABLE | CFG_ADVANCED | CFG_UNSUPPORTED | CFG_DEFAULT_UNDEFINED, vsn(1, 0, 0), NULL)
+cfg(disk_area_start_sector_CFG, "start_sector", disk_area_CFG_SUBSECTION, CFG_ADVANCED | CFG_UNSUPPORTED | CFG_DEFAULT_UNDEFINED, CFG_TYPE_INT, 0, vsn(1, 0, 0), NULL)
+cfg(disk_area_size_CFG, "size", disk_area_CFG_SUBSECTION, CFG_ADVANCED | CFG_UNSUPPORTED | CFG_DEFAULT_UNDEFINED, CFG_TYPE_INT, 0, vsn(1, 0, 0), NULL)
+cfg(disk_area_id_CFG, "id", disk_area_CFG_SUBSECTION, CFG_ADVANCED | CFG_UNSUPPORTED | CFG_DEFAULT_UNDEFINED, CFG_TYPE_STRING, NULL, vsn(1, 0, 0), NULL)
cfg(report_aligned_CFG, "aligned", report_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_REP_ALIGNED, vsn(1, 0, 0), NULL)
cfg(report_buffered_CFG, "buffered", report_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_REP_BUFFERED, vsn(1, 0, 0), NULL)
@@ -250,7 +251,7 @@ cfg(dmeventd_executable_CFG, "executable", dmeventd_CFG_SECTION, 0, CFG_TYPE_STR
cfg(tags_hosttags_CFG, "hosttags", tags_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_HOSTTAGS, vsn(1, 0, 18), NULL)
-cfg_section(tag_CFG_SUBSECTION, "tag", tags_CFG_SECTION, CFG_NAME_VARIABLE, vsn(1, 0, 18), NULL)
-cfg(tag_host_list_CFG, "host_list", tag_CFG_SUBSECTION, CFG_ALLOW_EMPTY, CFG_TYPE_STRING, NULL, vsn(1, 0, 18), NULL)
+cfg_section(tag_CFG_SUBSECTION, "tag", tags_CFG_SECTION, CFG_NAME_VARIABLE | CFG_DEFAULT_UNDEFINED, vsn(1, 0, 18), NULL)
+cfg(tag_host_list_CFG, "host_list", tag_CFG_SUBSECTION, CFG_ALLOW_EMPTY | CFG_DEFAULT_UNDEFINED, CFG_TYPE_STRING, NULL, vsn(1, 0, 18), NULL)
cfg(CFG_COUNT, NULL, root_CFG_SECTION, 0, CFG_TYPE_INT, 0, vsn(0, 0, 0), NULL)
diff --git a/tools/dumpconfig.c b/tools/dumpconfig.c
index 18fba34..cb88bc6 100644
--- a/tools/dumpconfig.c
+++ b/tools/dumpconfig.c
@@ -193,6 +193,12 @@ int dumpconfig(struct cmd_context *cmd, int argc, char **argv)
goto out;
}
+ if (arg_count(cmd, withcomments_ARG))
+ tree_spec.withcomments = 1;
+
+ if (arg_count(cmd, withversions_ARG))
+ tree_spec.withversions = 1;
+
if (cft_check_handle)
tree_spec.check_status = cft_check_handle->status;
@@ -202,9 +208,7 @@ int dumpconfig(struct cmd_context *cmd, int argc, char **argv)
goto_out;
}
- if (!config_write(cft, arg_count(cmd, withcomments_ARG),
- arg_count(cmd, withversions_ARG),
- file, argc, argv)) {
+ if (!config_write(cft, &tree_spec, file, argc, argv)) {
stack;
r = ECMD_FAILED;
}
10 years, 2 months
master - config: use DMEVENTD_PATH for default dmeventd executable config
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=d0b5e51d29d5d1...
Commit: d0b5e51d29d5d1c03b3fd561ced3755383d5f4c3
Parent: 1b566a2152f5b7fcf55f2c148a5fe52d7370666e
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Tue Feb 25 11:04:48 2014 +0100
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Tue Feb 25 11:32:29 2014 +0100
config: use DMEVENTD_PATH for default dmeventd executable config
---
lib/config/config_settings.h | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/lib/config/config_settings.h b/lib/config/config_settings.h
index ae91e2d..f1900b8 100644
--- a/lib/config/config_settings.h
+++ b/lib/config/config_settings.h
@@ -246,7 +246,7 @@ cfg(dmeventd_mirror_library_CFG, "mirror_library", dmeventd_CFG_SECTION, 0, CFG_
cfg(dmeventd_raid_library_CFG, "raid_library", dmeventd_CFG_SECTION, 0, CFG_TYPE_STRING, DEFAULT_DMEVENTD_RAID_LIB, vsn(2, 2, 87), NULL)
cfg(dmeventd_snapshot_library_CFG, "snapshot_library", dmeventd_CFG_SECTION, 0, CFG_TYPE_STRING, DEFAULT_DMEVENTD_SNAPSHOT_LIB, vsn(1, 2, 26), NULL)
cfg(dmeventd_thin_library_CFG, "thin_library", dmeventd_CFG_SECTION, 0, CFG_TYPE_STRING, DEFAULT_DMEVENTD_THIN_LIB, vsn(2, 2, 89), NULL)
-cfg(dmeventd_executable_CFG, "executable", dmeventd_CFG_SECTION, 0, CFG_TYPE_STRING, NULL, vsn(2, 2, 73), NULL)
+cfg(dmeventd_executable_CFG, "executable", dmeventd_CFG_SECTION, 0, CFG_TYPE_STRING, DMEVENTD_PATH, vsn(2, 2, 73), NULL)
cfg(tags_hosttags_CFG, "hosttags", tags_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_HOSTTAGS, vsn(1, 0, 18), NULL)
10 years, 2 months
master - cleanup: keep pv_count unsigned
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=1b566a2152f5b7...
Commit: 1b566a2152f5b7fcf55f2c148a5fe52d7370666e
Parent: e7d189baf741d8f27c66cb53ea15f78dcc29efec
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Feb 25 09:43:04 2014 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Feb 25 09:43:04 2014 +0100
cleanup: keep pv_count unsigned
---
tools/lvcreate.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/lvcreate.c b/tools/lvcreate.c
index 7a734f2..dc473f8 100644
--- a/tools/lvcreate.c
+++ b/tools/lvcreate.c
@@ -21,7 +21,7 @@ struct lvcreate_cmdline_params {
percent_type_t percent;
uint64_t size;
char **pvs;
- int pv_count;
+ uint32_t pv_count;
};
static int _set_vg_name(struct lvcreate_params *lp, const char *vg_name)
@@ -1181,7 +1181,7 @@ static int _check_raid_parameters(struct volume_group *vg,
struct lvcreate_params *lp,
struct lvcreate_cmdline_params *lcp)
{
- int devs = lcp->pv_count ? lcp->pv_count : dm_list_size(&vg->pvs);
+ unsigned devs = lcp->pv_count ? : dm_list_size(&vg->pvs);
struct cmd_context *cmd = vg->cmd;
/*
10 years, 2 months
master - allocation: add default path
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=e7d189baf741d8...
Commit: e7d189baf741d8f27c66cb53ea15f78dcc29efec
Parent: 3e49753e6cf9886472c3e7cd11da456f1bd856d1
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Feb 25 09:36:26 2014 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Feb 25 09:36:26 2014 +0100
allocation: add default path
Make it obvious for compiler extents is always defined for
valid code path.
---
lib/metadata/lv_manip.c | 3 +++
tools/lvcreate.c | 5 ++++-
2 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index c4b644c..9dd8f0e 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -3858,6 +3858,9 @@ static int _lvresize_adjust_extents(struct cmd_context *cmd, struct logical_volu
case PERCENT_NONE:
extents = lp->extents;
break;
+ default:
+ log_error(INTERNAL_ERROR "Unsupported percent type %u.", lp->percent);
+ return 0;
}
if (lp->percent != PERCENT_NONE) {
diff --git a/tools/lvcreate.c b/tools/lvcreate.c
index 7d9d22e..7a734f2 100644
--- a/tools/lvcreate.c
+++ b/tools/lvcreate.c
@@ -363,7 +363,7 @@ static int _update_extents_params(struct volume_group *vg,
} else
lp->pvh = &vg->pvs;
- switch(lcp->percent) {
+ switch (lcp->percent) {
case PERCENT_VG:
extents = percent_of_extents(lp->extents, vg->extent_count, 0);
break;
@@ -397,6 +397,9 @@ static int _update_extents_params(struct volume_group *vg,
case PERCENT_NONE:
extents = lp->extents;
break;
+ default:
+ log_error(INTERNAL_ERROR "Unsupported percent type %u.", lcp->percent);
+ return 0;
}
if (lcp->percent) {
10 years, 2 months
master - tests: cache needs 1.3
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=3e49753e6cf988...
Commit: 3e49753e6cf9886472c3e7cd11da456f1bd856d1
Parent: 502213e06ca8d30eaa957c284802c0bff4cb8940
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Feb 25 09:36:07 2014 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Feb 25 09:36:07 2014 +0100
tests: cache needs 1.3
---
test/shell/lvcreate-cache.sh | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/test/shell/lvcreate-cache.sh b/test/shell/lvcreate-cache.sh
index c4c0794..ccfb4ad 100644
--- a/test/shell/lvcreate-cache.sh
+++ b/test/shell/lvcreate-cache.sh
@@ -11,7 +11,7 @@
. lib/test
-aux target_at_least dm-cache 1 2 0 || skip
+aux target_at_least dm-cache 1 3 0 || skip
# Skip in cluster for now, but should test EX mode...
test -e LOCAL_CLVMD && skip
10 years, 2 months
master - mirror: move declaration to define
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=502213e06ca8d3...
Commit: 502213e06ca8d30eaa957c284802c0bff4cb8940
Parent: 962af71b7635ead2bc4449a1dd0bd4d4a2b46b07
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Feb 25 09:35:26 2014 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Feb 25 09:35:26 2014 +0100
mirror: move declaration to define
For compilation without cmirrord hide unused vars.
(in-release update)
---
lib/mirror/mirrored.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/mirror/mirrored.c b/lib/mirror/mirrored.c
index 57c6bba..5088173 100644
--- a/lib/mirror/mirrored.c
+++ b/lib/mirror/mirrored.c
@@ -465,8 +465,6 @@ static int _mirrored_target_present(struct cmd_context *cmd,
uint32_t maj, min, patchlevel;
unsigned maj2, min2, patchlevel2;
char vsn[80];
- struct utsname uts;
- unsigned kmaj, kmin, krel;
if (!_mirrored_checked) {
_mirrored_checked = 1;
@@ -501,6 +499,8 @@ static int _mirrored_target_present(struct cmd_context *cmd,
* contact.
*/
if (dm_daemon_is_running(CMIRRORD_PIDFILE)) {
+ struct utsname uts;
+ unsigned kmaj, kmin, krel;
/*
* The dm-log-userspace module was added to the
* 2.6.31 kernel.
10 years, 2 months
master - mirror: look for mirror seg only in mirror LV
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=962af71b7635ea...
Commit: 962af71b7635ead2bc4449a1dd0bd4d4a2b46b07
Parent: b84797be3278e2ec232b8de7293dcac665d980f0
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Feb 25 09:34:02 2014 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Feb 25 09:34:02 2014 +0100
mirror: look for mirror seg only in mirror LV
Find mirror seg only in MIRROR_IMAGE.
(in-release update)
---
lib/metadata/lv.c | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/lib/metadata/lv.c b/lib/metadata/lv.c
index 2f2b7cb..4549f03 100644
--- a/lib/metadata/lv.c
+++ b/lib/metadata/lv.c
@@ -396,11 +396,11 @@ static int _lv_mimage_in_sync(const struct logical_volume *lv)
struct lv_segment *seg = first_seg(lv);
struct lv_segment *mirror_seg;
- if (seg)
- mirror_seg = find_mirror_seg(seg);
-
- if (!(lv->status & MIRROR_IMAGE) || !seg || !mirror_seg)
- return_0;
+ if (!(lv->status & MIRROR_IMAGE) || !seg ||
+ !(mirror_seg = find_mirror_seg(seg))) {
+ log_error(INTERNAL_ERROR "Cannot find mirror segment.");
+ return 0;
+ }
if (!lv_mirror_percent(lv->vg->cmd, mirror_seg->lv, 0, &percent,
NULL))
10 years, 2 months