master - tests: lvcreate thin-pool support --name
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=de0e6029f18a78...
Commit: de0e6029f18a78a816f3c183d42ab641001dbebe
Parent: 4baf4b8cf982a3ead10b9644b5c04ec3575e3009
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sun Oct 5 20:00:39 2014 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Oct 6 15:23:08 2014 +0200
tests: lvcreate thin-pool support --name
---
test/shell/lvcreate-thin.sh | 26 +++++++++++++++++++++++++-
1 files changed, 25 insertions(+), 1 deletions(-)
diff --git a/test/shell/lvcreate-thin.sh b/test/shell/lvcreate-thin.sh
index 215bfac..42ea635 100644
--- a/test/shell/lvcreate-thin.sh
+++ b/test/shell/lvcreate-thin.sh
@@ -1,6 +1,6 @@
#!/bin/sh
-# Copyright (C) 2011-2013 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2011-2014 Red Hat, Inc. All rights reserved.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions
@@ -50,6 +50,30 @@ lvremove -ff $vg/pool1 $vg/pool2 $vg/pool3 $vg/pool4 $vg/pool5 $vg/pool6 $vg/poo
check vg_field $vg lv_count 0
+# Let's pretend pool is like normal LV when using --type thin-pool support --name
+# Reject ambigous thin pool names
+invalid lvcreate --type thin-pool -l1 --name pool1 $vg/pool2
+invalid lvcreate --type thin-pool -l1 --name pool3 --thinpool pool4 $vg
+invalid lvcreate --type thin-pool -l1 --name pool5 --thinpool pool6 $vg/pool7
+invalid lvcreate --type thin-pool -l1 --name pool8 --thinpool pool8 $vg/pool9
+check vg_field $vg lv_count 0
+
+lvcreate --type thin-pool -l1 --name pool1 $vg
+lvcreate --type thin-pool -l1 --name $vg/pool2
+# If the thin pool name is unambigous let it proceed
+lvcreate --type thin-pool -l1 --name pool3 $vg/pool3
+lvcreate --type thin-pool -l1 --name pool4 --thinpool $vg/pool4
+lvcreate --type thin-pool -l1 --name pool5 --thinpool $vg/pool5 $vg/pool5
+
+check lv_field $vg/pool1 segtype "thin-pool"
+check lv_field $vg/pool2 segtype "thin-pool"
+check lv_field $vg/pool3 segtype "thin-pool"
+check lv_field $vg/pool4 segtype "thin-pool"
+check lv_field $vg/pool5 segtype "thin-pool"
+
+lvremove -ff $vg
+
+
# Create default pool name
lvcreate -l1 -T $vg
lvcreate -l1 --type thin $vg
9 years, 7 months
master - tests: lvcreate cache interface updates
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=4baf4b8cf982a3...
Commit: 4baf4b8cf982a3ead10b9644b5c04ec3575e3009
Parent: b7a78d81bc52b8a9078bd9d57ab900032f8e5729
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Oct 3 19:02:37 2014 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Oct 6 15:23:08 2014 +0200
tests: lvcreate cache interface updates
---
test/shell/lvcreate-cache.sh | 160 +++++++++++++++++++++++++++---------------
1 files changed, 103 insertions(+), 57 deletions(-)
diff --git a/test/shell/lvcreate-cache.sh b/test/shell/lvcreate-cache.sh
index 84c9c88..63591c4 100644
--- a/test/shell/lvcreate-cache.sh
+++ b/test/shell/lvcreate-cache.sh
@@ -9,30 +9,72 @@
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Exercise creation of cache and cache pool volumes
+
+# Full CLI uses --type
+# Shorthand CLI uses --cache | -H
+
. lib/inittest
aux have_cache 1 3 0 || skip
-aux prepare_vg 5 80
+# FIXME: parallel cache metadata allocator is crashing when used value 8000!
+aux prepare_vg 5 80000
-for mode in "" "--cachemode writethrough"
-do
+#######################
+# Cache_Pool creation #
+#######################
-####################
-# Cache_Pool creation
-####################
+# FIXME: Unsupported yet creation of cache pool and cached volume at once
+# needs some policy to determine cache pool size
+invalid lvcreate -H -l 1 $vg
+invalid lvcreate --cache -l 1 $vg
+invalid lvcreate --type cache -l 1 $vg
-# Full CLI (the advertised form)
-lvcreate --type cache-pool -l 1 -n cache_pool $vg $mode
-lvremove -f $vg/cache_pool
+# Unlike in thin pool case - cache pool and cached volume both need size arg.
+# So we require cache pool to exist and need to fail when it's missing.
+#
+# FIXME: introduce --poolsize to make this command possible to pass
+fail lvcreate -l 1 -H --cachepool $vg/pool3
+fail lvcreate -l 1 -H --cachepool pool4 $vg
+fail lvcreate -l 1 --type cache --cachepool $vg/pool5
+fail lvcreate -l 1 --type cache --cachepool pool6 $vg
+# --cachpool bring implicit --cache
+fail lvcreate -l 1 --cachepool pool7 $vg
+
+# Check nothing has been created yet
+check vg_field $vg lv_count 0
+
+# If the cache pool volume doesn't yet exist -> cache pool creation
+lvcreate -l 1 -H $vg/pool1
+lvcreate -l 1 --type cache $vg/pool2
+
+# With cache-pool we are clear what has to be created
+lvcreate -l 1 --type cache-pool $vg/pool3
+lvcreate -l 1 --type cache-pool --cachepool $vg/pool4
+lvcreate -l 1 --type cache-pool --cachepool pool5 $vg
+lvcreate -l 1 --type cache-pool --name pool6 $vg
+lvcreate -l 1 --type cache-pool --name $vg/pool7
+
+check lv_field $vg/pool1 segtype "cache-pool"
+check lv_field $vg/pool2 segtype "cache-pool"
+check lv_field $vg/pool3 segtype "cache-pool"
+check lv_field $vg/pool4 segtype "cache-pool"
+check lv_field $vg/pool5 segtype "cache-pool"
+check lv_field $vg/pool6 segtype "cache-pool"
+check lv_field $vg/pool7 segtype "cache-pool"
+
+lvremove -f $vg
-# Shorthand CLI (not advertised) -- not yet implemented
-# lvcreate --cache -l 1 vg
-# lvremove -ff $vg
+# Validate ambiguos pool name is detected
+invalid lvcreate -l 1 --type cache-pool --cachepool pool1 $vg/pool2
+invalid lvcreate -l 1 --type cache-pool --name pool3 --cachepool pool4 $vg
+invalid lvcreate -l 1 --type cache-pool --name pool6 --cachepool pool6 $vg/pool7
+invalid lvcreate -l 1 --type cache-pool --name pool8 $vg/pool9
+check vg_field $vg lv_count 0
-# Shorthand CLI (not advertised) -- not yet implemented
-# lvcreate -H -l 1 vg
-# lvremove -ff $vg
+for mode in "" "--cachemode writethrough"
+do
################
# Cache creation
@@ -41,68 +83,72 @@ lvremove -f $vg/cache_pool
# - then, the cache LV (lvcreate distinguishes supplied origin vs cache_pool)
################
-# Create cache_pool, then origin with cache, then remove all
-lvcreate --type cache-pool -l 1 -n cache_pool $vg
-lvcreate --type cache -l 2 $vg/cache_pool -n $lv1 $mode
+lvcreate --type cache-pool -l 1 -n pool $vg $mode
+# Select automatic name for cached LV
+lvcreate --type cache -l1 $vg/pool
+
+lvcreate --type cache-pool -l 1 -n pool1 $vg $mode
+lvcreate --cache -l1 -n $lv1 --cachepool $vg/pool1
dmsetup table ${vg}-$lv1 | grep cache # ensure it is loaded in kernel
-lvremove -f $vg
-# Create cache_pool, then origin with cache, then remove cache_pool/cache
-lvcreate --type cache-pool -l 1 -n cache_pool $vg
-lvcreate --type cache -l 2 $vg/cache_pool -n $lv1 $mode
-lvremove -f $vg/cache_pool
-lvremove -f $vg/$lv1
+lvcreate --type cache-pool -l 1 -n pool2 $vg $mode
+lvcreate -H -l1 -n $lv2 --cachepool pool2 $vg
-# Create cache_pool, then origin with cache, then remove origin
-lvcreate --type cache-pool -l 1 -n cache_pool $vg
-lvcreate --type cache -l 2 $vg/cache_pool -n $lv1 $mode
+#
+# Now check removals
+#
+
+# Removal of cached LV removes every related LV
+check lv_field $vg/$lv1 segtype "cache"
lvremove -f $vg/$lv1
-lvremove -f $vg/cache_pool
+check lv_not_exists $vg $lv1 pool1 pool1_cdata pool1_cmeta
+# to preserve cachepool use lvconvert --splitcache $vg/$lv1
+
+# Removal of cache pool leaves origin uncached
+check lv_field $vg/$lv2 segtype "cache"
+lvremove -f $vg/pool2
+check lv_not_exists $vg pool2 pool2_cdata pool2_cmeta
+check lv_field $vg/$lv2 segtype "linear"
-# Shorthand CLI (cache_pool exists, create origin w/ cache)
-#lvcreate --type cache-pool -l 1 -n cache_pool $vg
-#lvcreate --cache -l 2 $vg/cache_pool -n $lv1
-#lvremove -f $vg
+lvremove -f $vg
-# Shorthand CLI (cache_pool exists, create origin w/ cache)
-#lvcreate --type cache-pool -l 1 -n cache_pool $vg
-#lvcreate -H -l 2 $vg/cache_pool -n $lv1
-#lvremove -f $vg
+done
+# Conversion through lvcreate case
# Bug 1110026
-# Create origin, then cache_pool and cache
+# Create origin, then cache pool and cache the origin
lvcreate -aey -l 2 -n $lv1 $vg
lvcreate --type cache -l 1 $vg/$lv1
-#should dmsetup table ${vg}-$lv1 | grep cache # ensure it is loaded in kernel
-lvremove -ff $vg
+dmsetup table ${vg}-$lv1 | grep cache # ensure it is loaded in kernel
# Bug 1110026 & Bug 1095843
-# Create RAID1 origin, then cache_pool and cache
-lvcreate -aey -l 2 -n $lv1 $vg
-lvcreate --type cache -l 1 $vg/$lv1
-#should lvs -a $vg/${lv1}_corig_rimage_0 # ensure images are properly renamed
-#should dmsetup table ${vg}-$lv1 | grep cache # ensure it is loaded in kernel
-lvremove -ff $vg
+# Create RAID1 origin, then cache pool and cache
+lvcreate -aey -l 2 --type raid1 -m1 -n $lv2 $vg
+lvcreate --cache -l 1 $vg/$lv2
+check lv_exists $vg/${lv2}_corig_rimage_0 # ensure images are properly renamed
+dmsetup table ${vg}-$lv2 | grep cache # ensure it is loaded in kernel
-# Shorthand CLI (origin exists, create cache_pool and cache)
-#lvcreate -l 1 -n $lv1 $vg
-#lvcreate --cache -l 2 $vg/$lv1
-#lvremove -ff $vg
+lvremove -f $vg
-# Shorthand CLI (origin exists, create cache_pool and cache)
-#lvcreate -l 1 -n $lv1 $vg
-#lvcreate -H -l 2 $vg/$lv1
-#lvremove -ff $vg
-done
+# Check minimum cache pool metadata size
+lvcreate -l 1 --type cache-pool --poolmetadatasize 1 $vg 2>out
+grep "WARNING: Minimum" out
+
+# FIXME: This test is failing in allocator with smaller VG sizes
+lvcreate -l 1 --type cache-pool --poolmetadatasize 17G $vg 2>out
+grep "WARNING: Maximum" out
+
+lvremove -f $vg
+
##############################
# Test things that should fail
##############################
-# Attempt to create smaller cache than origin should fail
-lvcreate -aey -l 1 -n $lv1 $vg
-not lvcreate --type cache -l 2 $vg/$lv1
+# Atempt to use bigger chunk size then cache pool data size
+fail lvcreate -l 1 --type cache-pool --chunksize 16M $vg 2>out
+grep "is bigger" out
# Option testing
# --chunksize
9 years, 7 months
master - cleanup: indent
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=b7a78d81bc52b8...
Commit: b7a78d81bc52b8a9078bd9d57ab900032f8e5729
Parent: d9d50e4533193d75057bb2444eb899d33598968a
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Oct 6 12:10:00 2014 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Oct 6 15:23:08 2014 +0200
cleanup: indent
---
tools/lvcreate.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/lvcreate.c b/tools/lvcreate.c
index 97c8d94..0dc3699 100644
--- a/tools/lvcreate.c
+++ b/tools/lvcreate.c
@@ -1240,8 +1240,8 @@ int lvcreate(struct cmd_context *cmd, int argc, char **argv)
{
int r = ECMD_FAILED;
struct lvcreate_params lp = {
- .major = -1,
- .minor = -1,
+ .major = -1,
+ .minor = -1,
};
struct lvcreate_cmdline_params lcp;
struct volume_group *vg;
9 years, 7 months
master - cleanup: typo update
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=d9d50e4533193d...
Commit: d9d50e4533193d75057bb2444eb899d33598968a
Parent: 916a68585e5078ff3f3190a9f77bee2f7b9b30a2
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Sep 30 21:01:05 2014 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Oct 6 15:23:08 2014 +0200
cleanup: typo update
---
lib/metadata/cache_manip.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/metadata/cache_manip.c b/lib/metadata/cache_manip.c
index 895eaff..0a6daf6 100644
--- a/lib/metadata/cache_manip.c
+++ b/lib/metadata/cache_manip.c
@@ -315,8 +315,8 @@ int lv_cache_remove(struct logical_volume *cache_lv)
*
* FIXME:
* fix _add_dev() to support this case better
- * since the should be handled interanlly by resume_lv()
- * which should autoremove any orhpans
+ * since that should be handled internally by resume_lv()
+ * which should autoremove any orphans
*/
if (!_cleanup_orphan_lv(corigin_lv)) /* _corig */
return_0;
9 years, 7 months
master - cleanup: error is already logged
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=916a68585e5078...
Commit: 916a68585e5078ff3f3190a9f77bee2f7b9b30a2
Parent: 73c74d582c27400f8cad939a52503e3721c0e153
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Oct 6 12:01:21 2014 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Oct 6 15:23:08 2014 +0200
cleanup: error is already logged
Function get_only_segment_using_this_lv() already prints error,
no need to show more internal logic to user as an error.
---
lib/metadata/pool_manip.c | 8 ++------
1 files changed, 2 insertions(+), 6 deletions(-)
diff --git a/lib/metadata/pool_manip.c b/lib/metadata/pool_manip.c
index 6e2f2fe..439b8ed 100644
--- a/lib/metadata/pool_manip.c
+++ b/lib/metadata/pool_manip.c
@@ -215,12 +215,8 @@ struct lv_segment *find_pool_seg(const struct lv_segment *seg)
{
struct lv_segment *pool_seg;
- pool_seg = get_only_segment_using_this_lv(seg->lv);
-
- if (!pool_seg) {
- log_error("Failed to find pool_seg for %s", seg->lv->name);
- return NULL;
- }
+ if (!(pool_seg = get_only_segment_using_this_lv(seg->lv)))
+ return_NULL;
if ((lv_is_thin_type(seg->lv) && !seg_is_pool(pool_seg))) {
log_error("%s on %s is not a %s pool segment",
9 years, 7 months
master - cleanup: lvconvert use standard function exit
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=73c74d582c2740...
Commit: 73c74d582c27400f8cad939a52503e3721c0e153
Parent: 8d272ba0ada6deae264e44705a4ce3b7ece93cd0
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sat Oct 4 17:17:49 2014 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Oct 6 15:23:07 2014 +0200
cleanup: lvconvert use standard function exit
Use 1|0 inside _lvconvert_splitsnapshot to match rest of code.
---
tools/lvconvert.c | 33 ++++++++++++++++++---------------
1 files changed, 18 insertions(+), 15 deletions(-)
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index 4bf4306..8f25561 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -1962,45 +1962,45 @@ static int _lvconvert_splitsnapshot(struct cmd_context *cmd, struct logical_volu
if (!lv_is_cow(cow)) {
log_error("%s/%s is not a snapshot.", vg->name, cow->name);
- return ECMD_FAILED;
+ return 0;
}
if (lv_is_origin(cow) || lv_is_external_origin(cow)) {
log_error("Unable to split LV %s/%s that is a snapshot origin.", vg->name, cow->name);
- return ECMD_FAILED;
+ return 0;
}
if (lv_is_merging_cow(cow)) {
log_error("Unable to split off snapshot %s/%s being merged into its origin.", vg->name, cow->name);
- return ECMD_FAILED;
+ return 0;
}
if (lv_is_virtual_origin(origin_from_cow(cow))) {
log_error("Unable to split off snapshot %s/%s with virtual origin.", vg->name, cow->name);
- return ECMD_FAILED;
+ return 0;
}
if (lv_is_thin_pool(cow) || lv_is_pool_metadata_spare(cow)) {
log_error("Unable to split off LV %s/%s needed by thin volume(s).", vg->name, cow->name);
- return ECMD_FAILED;
+ return 0;
}
if (!(vg->fid->fmt->features & FMT_MDAS)) {
log_error("Unable to split off snapshot %s/%s using old LVM1-style metadata.", vg->name, cow->name);
- return ECMD_FAILED;
+ return 0;
}
if (!vg_check_status(vg, LVM_WRITE))
- return_ECMD_FAILED;
+ return_0;
if (lv_is_pvmove(cow) || lv_is_mirror_type(cow) || lv_is_raid_type(cow) || lv_is_thin_type(cow)) {
log_error("LV %s/%s type is unsupported with --splitsnapshot.", vg->name, cow->name);
- return ECMD_FAILED;
+ return 0;
}
if (lv_is_active_locally(cow)) {
if (!lv_check_not_in_use(cow))
- return_ECMD_FAILED;
+ return_0;
if ((lp->force == PROMPT) && !lp->yes &&
lv_is_visible(cow) &&
@@ -2008,24 +2008,24 @@ static int _lvconvert_splitsnapshot(struct cmd_context *cmd, struct logical_volu
if (yes_no_prompt("Do you really want to split off active "
"logical volume %s? [y/n]: ", cow->name) == 'n') {
log_error("Logical volume %s not split.", cow->name);
- return ECMD_FAILED;
+ return 0;
}
}
}
if (!archive(vg))
- return_ECMD_FAILED;
+ return_0;
log_verbose("Splitting snapshot %s/%s from its origin.", vg->name, cow->name);
if (!vg_remove_snapshot(cow))
- return_ECMD_FAILED;
+ return_0;
backup(vg);
log_print_unless_silent("Logical Volume %s/%s split from its origin.", vg->name, cow->name);
- return ECMD_PROCESSED;
+ return 1;
}
@@ -3239,8 +3239,11 @@ static int _lvconvert_single(struct cmd_context *cmd, struct logical_volume *lv,
return ECMD_FAILED;
}
- if (lp->splitsnapshot)
- return _lvconvert_splitsnapshot(cmd, lv, lp);
+ if (lp->splitsnapshot) {
+ if (!_lvconvert_splitsnapshot(cmd, lv, lp))
+ return_ECMD_FAILED;
+ return ECMD_PROCESSED;
+ }
if (lp->splitcache) {
if (!_lvconvert_splitcache(cmd, lv, lp))
9 years, 7 months
master - validation: use validate_pool_chunk_size
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=8d272ba0ada6de...
Commit: 8d272ba0ada6deae264e44705a4ce3b7ece93cd0
Parent: 6c4429900645959966784dd0f0045ec0c4f6233f
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Oct 6 11:54:25 2014 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Oct 6 15:23:07 2014 +0200
validation: use validate_pool_chunk_size
We could validation pool chunk size with a single function.
---
lib/metadata/merge.c | 10 +++-------
1 files changed, 3 insertions(+), 7 deletions(-)
diff --git a/lib/metadata/merge.c b/lib/metadata/merge.c
index 0afe596..ad918f1 100644
--- a/lib/metadata/merge.c
+++ b/lib/metadata/merge.c
@@ -224,13 +224,9 @@ int check_lv_segments(struct logical_volume *lv, int complete_vg)
inc_error_count;
}
- if ((seg_is_thin_pool(seg) &&
- ((seg->chunk_size < DM_THIN_MIN_DATA_BLOCK_SIZE) ||
- (seg->chunk_size > DM_THIN_MAX_DATA_BLOCK_SIZE))) ||
- (seg_is_cache_pool(seg) &&
- ((seg->chunk_size < DM_CACHE_MIN_DATA_BLOCK_SIZE) ||
- (seg->chunk_size > DM_CACHE_MAX_DATA_BLOCK_SIZE)))) {
- log_error("LV %s: %s segment %u has chunk size %u out of range.",
+ if (seg_is_pool(seg) &&
+ !validate_pool_chunk_size(lv->vg->cmd, seg->segtype, seg->chunk_size)) {
+ log_error("LV %s: %s segment %u has invalid chunk size %u.",
lv->name, seg->segtype->name, seg_count, seg->chunk_size);
inc_error_count;
}
9 years, 7 months
master - validation: share more code for pool validation
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=6c442990064595...
Commit: 6c4429900645959966784dd0f0045ec0c4f6233f
Parent: 57a52e787843ce1f370f7e60d2f75f78d9f03d54
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Oct 3 18:48:42 2014 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Oct 6 15:23:07 2014 +0200
validation: share more code for pool validation
Reuse thin validation code for cache pool validation.
---
lib/metadata/merge.c | 8 ++++----
lib/metadata/metadata-exported.h | 1 +
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/lib/metadata/merge.c b/lib/metadata/merge.c
index 37026d1..0afe596 100644
--- a/lib/metadata/merge.c
+++ b/lib/metadata/merge.c
@@ -110,7 +110,7 @@ int check_lv_segments(struct logical_volume *lv, int complete_vg)
}
}
- if (lv_is_thin_pool_data(lv) &&
+ if (lv_is_pool_data(lv) &&
(!(seg2 = first_seg(lv)) || !(seg2 = find_pool_seg(seg2)) ||
seg2->area_count != 1 || seg_type(seg2, 0) != AREA_LV ||
seg_lv(seg2, 0) != lv)) {
@@ -119,7 +119,7 @@ int check_lv_segments(struct logical_volume *lv, int complete_vg)
inc_error_count;
}
- if (lv_is_thin_pool_metadata(lv) &&
+ if (lv_is_pool_metadata(lv) &&
(!(seg2 = first_seg(lv)) || !(seg2 = find_pool_seg(seg2)) ||
seg2->metadata_lv != lv)) {
log_error("LV %s: segment 1 pool metadata LV does not point back to same LV",
@@ -236,7 +236,7 @@ int check_lv_segments(struct logical_volume *lv, int complete_vg)
}
} else {
if (seg->metadata_lv) {
- log_error("LV %s: segment %u must not have thin pool metadata LV set",
+ log_error("LV %s: segment %u must not have pool metadata LV set",
lv->name, seg_count);
inc_error_count;
}
@@ -301,7 +301,7 @@ int check_lv_segments(struct logical_volume *lv, int complete_vg)
}
} else {
if (seg->pool_lv) {
- log_error("LV %s: segment %u must not have thin pool LV set",
+ log_error("LV %s: segment %u must not have pool LV set",
lv->name, seg_count);
inc_error_count;
}
diff --git a/lib/metadata/metadata-exported.h b/lib/metadata/metadata-exported.h
index f8a84de..4843d2c 100644
--- a/lib/metadata/metadata-exported.h
+++ b/lib/metadata/metadata-exported.h
@@ -199,6 +199,7 @@
#define lv_is_cache_type(lv) (((lv)->status & (CACHE | CACHE_POOL | CACHE_POOL_DATA | CACHE_POOL_METADATA)) ? 1 : 0)
#define lv_is_pool(lv) (((lv)->status & (CACHE_POOL | THIN_POOL)) ? 1 : 0)
+#define lv_is_pool_data(lv) (((lv)->status & (CACHE_POOL_DATA | THIN_POOL_DATA)) ? 1 : 0)
#define lv_is_pool_metadata(lv) (((lv)->status & (CACHE_POOL_METADATA | THIN_POOL_METADATA)) ? 1 : 0)
#define lv_is_pool_metadata_spare(lv) (((lv)->status & POOL_METADATA_SPARE) ? 1 : 0)
9 years, 7 months
master - lvcreate: validate sizes
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=57a52e787843ce...
Commit: 57a52e787843ce1f370f7e60d2f75f78d9f03d54
Parent: a0693da97f6873b08d33f8c44baacde77e28e33a
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Oct 6 13:54:34 2014 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Oct 6 15:23:07 2014 +0200
lvcreate: validate sizes
Earlier validation of --size and --extents.
Reject 0 size on command line instantly.
---
tools/lvcreate.c | 14 ++++++++++----
1 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/tools/lvcreate.c b/tools/lvcreate.c
index 0a0ce1d..97c8d94 100644
--- a/tools/lvcreate.c
+++ b/tools/lvcreate.c
@@ -506,20 +506,26 @@ static int _read_size_params(struct lvcreate_params *lp,
if (arg_count(cmd, extents_ARG)) {
if (arg_sign_value(cmd, extents_ARG, SIGN_NONE) == SIGN_MINUS) {
- log_error("Negative number of extents is invalid");
+ log_error("Negative number of extents is invalid.");
+ return 0;
+ }
+ if (!(lp->extents = arg_uint_value(cmd, extents_ARG, 0))) {
+ log_error("Number of extents may not be zero.");
return 0;
}
- lp->extents = arg_uint_value(cmd, extents_ARG, 0);
lcp->percent = arg_percent_value(cmd, extents_ARG, PERCENT_NONE);
}
/* Size returned in kilobyte units; held in sectors */
if (arg_count(cmd, size_ARG)) {
if (arg_sign_value(cmd, size_ARG, SIGN_NONE) == SIGN_MINUS) {
- log_error("Negative size is invalid");
+ log_error("Negative size is invalid.");
+ return 0;
+ }
+ if (!(lcp->size = arg_uint64_value(cmd, size_ARG, UINT64_C(0)))) {
+ log_error("Size may not be zero.");
return 0;
}
- lcp->size = arg_uint64_value(cmd, size_ARG, UINT64_C(0));
lcp->percent = PERCENT_NONE;
}
9 years, 7 months
master - toolib: early validation of chunk size
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=a0693da97f6873...
Commit: a0693da97f6873b08d33f8c44baacde77e28e33a
Parent: 59ced3c28186e6d45e2e8374b04e32256f636a82
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sat Oct 4 22:36:41 2014 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Oct 6 15:23:07 2014 +0200
toolib: early validation of chunk size
Since we now have validate_pool_chunk_size() we could
validate entered values directly prior openning vg.
---
tools/toollib.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/tools/toollib.c b/tools/toollib.c
index 69c1c39..ddd669a 100644
--- a/tools/toollib.c
+++ b/tools/toollib.c
@@ -1257,6 +1257,10 @@ int get_pool_params(struct cmd_context *cmd,
*passed_args |= PASS_ARG_CHUNK_SIZE;
*chunk_size = arg_uint_value(cmd, chunksize_ARG, 0);
+
+ if (!validate_pool_chunk_size(cmd, segtype, *chunk_size))
+ return_0;
+
log_very_verbose("Setting pool chunk size: %s",
display_size(cmd, *chunk_size));
}
9 years, 7 months