commit e56934c37ce575239fec2fe057cfe81f32be8263 Author: Peter Rajnoha Date: Thu Oct 10 10:14:27 2013 +0200 0 --- WHATS_NEW | 4 ++++ test/shell/lvconvert-thin-external.sh | 8 ++++++++ tools/lvconvert.c | 3 ++- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/WHATS_NEW b/WHATS_NEW index d69e74e..d8d6e7c 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -1,3 +1,7 @@ +Version 2.02.104 - +=================================== + Fix lvconvert when converting to a thin pool and thin LV at once. + Version 2.02.103 - 4th October 2013 =================================== Ensure vgid matches before removing vgname entry from lvmetad cache. diff --git a/test/shell/lvconvert-thin-external.sh b/test/shell/lvconvert-thin-external.sh index a700b37..d9d4d19 100644 --- a/test/shell/lvconvert-thin-external.sh +++ b/test/shell/lvconvert-thin-external.sh @@ -144,5 +144,13 @@ lvs -a -o+origin_size,seg_size,segtype $vg lvremove -f $vg/extorg2 # Only pool is left check vg_field $vg lv_count 1 +lvremove -ff $vg + +# Test conversion to the pool and thin external at the same time (rhbz #1003461) +lvcreate -l50 -n pool $vg +lvcreate -l100 -n thin $vg +lvconvert --thin --thinpool $vg/pool $vg/thin --originname thin-origin +check lv_field $vg/thin segtype thin +check lv_field $vg/thin-origin segtype linear vgremove -ff $vg diff --git a/tools/lvconvert.c b/tools/lvconvert.c index 49881fa..1970ca3 100644 --- a/tools/lvconvert.c +++ b/tools/lvconvert.c @@ -2266,7 +2266,7 @@ static int _lvconvert_thinpool(struct cmd_context *cmd, int r = 0; const char *old_name; struct lv_segment *seg; - struct logical_volume *data_lv = pool_lv; + struct logical_volume *data_lv; struct logical_volume *metadata_lv; struct logical_volume *pool_metadata_lv; struct logical_volume *external_lv = NULL; @@ -2304,6 +2304,7 @@ static int _lvconvert_thinpool(struct cmd_context *cmd, } } + data_lv = pool_lv; if (lv_is_thin_type(pool_lv) && !lp->pool_metadata_lv_name) { log_error("Can't use thin logical volume %s/%s for thin pool data.", pool_lv->vg->name, pool_lv->name);