diff options
author | Zdenek Kabelac <zkabelac@redhat.com> | 2017-06-09 10:59:37 +0200 |
---|---|---|
committer | Zdenek Kabelac <zkabelac@redhat.com> | 2017-06-09 10:59:37 +0200 |
commit | b3ef051e0637ac7f72ab245342e5a29394071c24 (patch) | |
tree | a75e831afcb4f1ac33237287d91f0213c52b3953 /tools/lvcreate.c | |
parent | f91ea96b4f221894008d196c1f87b93527c51311 (diff) | |
download | lvm2-b3ef051e0637ac7f72ab245342e5a29394071c24.tar.gz |
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.
Diffstat (limited to 'tools/lvcreate.c')
-rw-r--r-- | tools/lvcreate.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/tools/lvcreate.c b/tools/lvcreate.c index e83c1309d..f46489631 100644 --- a/tools/lvcreate.c +++ b/tools/lvcreate.c @@ -1193,6 +1193,13 @@ static int _determine_cache_argument(struct volume_group *vg, lp->create_pool = 0; lp->origin_name = NULL; } 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 */ if (!validate_lv_cache_create_origin(lv)) return_0; |