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

thin: more validation of thin name

Avoid starting conversion of the LV to the thin pool and thin volume
at the same time.  Since this is mostly a user mistake, do not try
to just convert to one of those type, since we cannot assume if the
user wanted LV to become thin volume or thin pool.

Before the fix tool reported pretty strange internal error:
Internal error: Referenced LV lvol1_tdata not listed in VG mvg.

Fixed output:
lvconvert --thinpool lvol0 -T mvg/lvol0
Can't use same LV mvg/lvol0 for thin pool and thin volume.
This commit is contained in:
Zdenek Kabelac 2014-01-28 13:21:39 +01:00
parent bc5f40ee1c
commit e9d9852c55
3 changed files with 11 additions and 0 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.106 -
====================================
Avoid trying to convert single to thin pool and volume at the same time.
Add support for partitions on ZFS zvol.
Fix unwanted drop of hold flocks on forked children.
Respect LVM_LVMETAD_PIDFILE env var for lvm command.

View File

@ -56,6 +56,10 @@ lvremove -f $vg/pool1
# create plain LV (will be used for external origin)
lvcreate -L8M -n $lv1 $vg
# Can't convert same LV to the thin pool and thin volume
not lvconvert --thinpool $vg/$lv1 -T $vg/$lv1
check lv_field $vg/$lv1 segtype linear
mkfs.ext2 $DM_DEV_DIR/$vg/$lv1
mkdir mnt
mount $DM_DEV_DIR/$vg/$lv1 mnt

View File

@ -2582,6 +2582,12 @@ static int _lvconvert_thinpool(struct cmd_context *cmd,
}
if (lp->thin) {
if (strcmp(pool_lv->name, lp->pool_data_lv_name) == 0) {
log_error("Can't use same LV %s/%s for thin pool and thin volume.",
pool_lv->vg->name, pool_lv->name);
return 0;
}
external_lv = pool_lv;
if (!(pool_lv = find_lv(external_lv->vg, lp->pool_data_lv_name))) {
log_error("Can't find pool LV %s/%s.",