mrc0mmand / rpms / lvm2

Forked from rpms/lvm2 2 years ago
Clone

Blame SOURCES/lvm2-2_02_104-fix-lvconvert-when-converting-to-a-thin-pool-and-thin-lv-at-once.patch

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