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

thin: lvconvert cannot convert pool to mirror

Suggest to use _tdata and _tmeta devices for that.
This fixes regression from too relaxed change in
f1d5f6ae81

Without this patch there are some empty LVs created before
mirror code recognizes it cannot continue.

(in release fix)
This commit is contained in:
Zdenek Kabelac 2013-07-24 15:25:22 +02:00
parent 7dc21c1597
commit da5284a500
2 changed files with 30 additions and 0 deletions

View File

@ -95,4 +95,7 @@ grep "WARNING: Chunk size is too small" err
#lvs -a -o+chunk_size,stripe_size,seg_pe_ranges
# Convertions of pool to mirror is unsupported
not lvconvert -m1 $vg/$lv1
vgremove -ff $vg

View File

@ -1553,6 +1553,27 @@ static int _lvconvert_mirrors_repair(struct cmd_context *cmd,
return 1;
}
static int _lvconvert_validate_thin(struct logical_volume *lv,
struct lvconvert_params *lp)
{
if (!lv_is_thin_pool(lv) && !lv_is_thin_volume(lv))
return 1;
log_error("Converting thin%s segment type for \"%s/%s\" to %s is not supported.",
lv_is_thin_pool(lv) ? " pool" : "",
lv->vg->name, lv->name, lp->segtype->name);
if (lv_is_thin_volume(lv))
return 0;
/* Give advice for thin pool conversion */
log_error("For pool data volume conversion use \"%s/%s\".",
lv->vg->name, seg_lv(first_seg(lv), 0)->name);
log_error("For pool metadata volume conversion use \"%s/%s\".",
lv->vg->name, first_seg(lv)->metadata_lv->name);
return 0;
}
/*
* _lvconvert_mirrors
*
@ -1575,6 +1596,9 @@ static int _lvconvert_mirrors(struct cmd_context *cmd,
return 0;
}
if (!_lvconvert_validate_thin(lv, lp))
return_0;
/* Adjust mimage and/or log count */
if (!_lvconvert_mirrors_parse_params(cmd, lv, lp,
&old_mimage_count, &old_log_count,
@ -1676,6 +1700,9 @@ static int lvconvert_raid(struct logical_volume *lv, struct lvconvert_params *lp
return 0;
}
if (!_lvconvert_validate_thin(lv, lp))
return_0;
if (!is_valid_raid_conversion(seg->segtype, lp->segtype)) {
log_error("Unable to convert %s/%s from %s to %s",
lv->vg->name, lv->name,