mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-16 03:25:10 +03:00
cache: lvcreate --cachepool checks for cache pool
Code path missed validation of lvcreate --cachepool argument. If the non cache-pool LV was passed in, code has still continued further work and failed later on internal error. Validate this condition at right place now.
This commit is contained in:
parent
f91ea96b4f
commit
b3ef051e06
@ -1,5 +1,6 @@
|
|||||||
Version 2.02.172 -
|
Version 2.02.172 -
|
||||||
===============================
|
===============================
|
||||||
|
Improve lvcreate --cachepool arg validation.
|
||||||
Limit maximal size of thin-pool for specific chunk size.
|
Limit maximal size of thin-pool for specific chunk size.
|
||||||
Print a warning about in-use PVs with no VG using them.
|
Print a warning about in-use PVs with no VG using them.
|
||||||
Disable automatic clearing of PVs that look like in-use orphans.
|
Disable automatic clearing of PVs that look like in-use orphans.
|
||||||
|
@ -26,6 +26,7 @@ aux prepare_vg 5 80000
|
|||||||
|
|
||||||
aux lvmconf 'global/cache_disabled_features = [ "policy_smq" ]'
|
aux lvmconf 'global/cache_disabled_features = [ "policy_smq" ]'
|
||||||
|
|
||||||
|
|
||||||
#######################
|
#######################
|
||||||
# Cache_Pool creation #
|
# Cache_Pool creation #
|
||||||
#######################
|
#######################
|
||||||
@ -62,6 +63,11 @@ grep "No command with matching syntax recognised" err
|
|||||||
# Check nothing has been created yet
|
# Check nothing has been created yet
|
||||||
check vg_field $vg lv_count 0
|
check vg_field $vg lv_count 0
|
||||||
|
|
||||||
|
# Checks that argument passed with --cachepool is really a cache-pool
|
||||||
|
lvcreate -an -l 1 -n $lv1 $vg
|
||||||
|
# Hint: nice way to 'tee' only stderr.log so we can check it's log_error()
|
||||||
|
fail lvcreate -L10 --cachepool $vg/$lv1 2> >(tee -a stderr.log >&2)
|
||||||
|
grep "not a cache pool" stderr.log
|
||||||
|
|
||||||
# With --type cache-pool we are clear which segtype has to be created
|
# With --type cache-pool we are clear which segtype has to be created
|
||||||
lvcreate -l 1 --type cache-pool $vg/pool1
|
lvcreate -l 1 --type cache-pool $vg/pool1
|
||||||
|
@ -1193,6 +1193,13 @@ static int _determine_cache_argument(struct volume_group *vg,
|
|||||||
lp->create_pool = 0;
|
lp->create_pool = 0;
|
||||||
lp->origin_name = NULL;
|
lp->origin_name = NULL;
|
||||||
} else if (lv) {
|
} else if (lv) {
|
||||||
|
if (arg_is_set(cmd, cachepool_ARG)) {
|
||||||
|
/* Argument of --cachepool has to be a cache-pool */
|
||||||
|
log_error("Logical volume %s is not a cache pool.",
|
||||||
|
display_lvname(lv));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* Origin exists, create cache pool volume */
|
/* Origin exists, create cache pool volume */
|
||||||
if (!validate_lv_cache_create_origin(lv))
|
if (!validate_lv_cache_create_origin(lv))
|
||||||
return_0;
|
return_0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user