1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

pool: prevent pool conversion with same name

When same name is given for converted volume and pool volume,
stop further command processing.
This commit is contained in:
Zdenek Kabelac 2014-11-22 23:37:31 +01:00
parent 0782309713
commit 8eb111dfb8
3 changed files with 15 additions and 4 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.113 - Version 2.02.113 -
===================================== =====================================
Validate converted volume and specified pool volume differ.
Fix regression in vgscan --mknodes usage (2.02.112). Fix regression in vgscan --mknodes usage (2.02.112).
Respect --prefix when setting CLMVD_PATH configure (2.02.89). Respect --prefix when setting CLMVD_PATH configure (2.02.89).
Default to configure --enable-udev-systemd-background-jobs for systemd>=205. Default to configure --enable-udev-systemd-background-jobs for systemd>=205.

View File

@ -103,6 +103,9 @@ invalid lvconvert -c -256 --thinpool $vg/$lv1 --poolmetadata $vg/$lv2
# non multiple of 64KiB fails # non multiple of 64KiB fails
invalid lvconvert -c 88 --thinpool $vg/$lv1 --poolmetadata $vg/$lv2 invalid lvconvert -c 88 --thinpool $vg/$lv1 --poolmetadata $vg/$lv2
# cannot use same LV for pool and convertion
fail lvconvert --yes --thinpool $vg/$lv3 -T $vg/$lv3
# Warning about smaller then suggested # Warning about smaller then suggested
lvconvert --yes -c 256 --thinpool $vg/$lv1 --poolmetadata $vg/$lv2 |& tee err lvconvert --yes -c 256 --thinpool $vg/$lv1 --poolmetadata $vg/$lv2 |& tee err
grep "WARNING: Chunk size is smaller" err grep "WARNING: Chunk size is smaller" err

View File

@ -2784,10 +2784,17 @@ static int _lvconvert_pool(struct cmd_context *cmd,
char metadata_name[NAME_LEN], data_name[NAME_LEN]; char metadata_name[NAME_LEN], data_name[NAME_LEN];
int activate_pool; int activate_pool;
if (lp->pool_data_name && if (lp->pool_data_name) {
!(pool_lv = find_lv(vg, lp->pool_data_name))) { if ((lp->thin || lp->cache) &&
log_error("Unknown pool data LV %s.", lp->pool_data_name); !strcmp(lp->pool_data_name, pool_lv->name)) {
return 0; log_error("Converted volume %s and pool volume must differ.",
display_lvname(pool_lv));
return 0;
}
if (!(pool_lv = find_lv(vg, lp->pool_data_name))) {
log_error("Unknown pool data LV %s.", lp->pool_data_name);
return 0;
}
} }
if (!lv_is_visible(pool_lv)) { if (!lv_is_visible(pool_lv)) {