mrc0mmand / rpms / lvm2

Forked from rpms/lvm2 2 years ago
Clone

Blame SOURCES/lvm2-2_02_182-lvconvert-fix-direct-raid0-to-striped-conversion.patch

5e29a5
 WHATS_NEW                             |  1 +
5e29a5
 lib/metadata/raid_manip.c             |  3 +++
5e29a5
 test/shell/lvconvert-raid0-striped.sh | 25 +++++++++++++++++++++++++
5e29a5
 3 files changed, 29 insertions(+)
5e29a5
 create mode 100644 test/shell/lvconvert-raid0-striped.sh
5e29a5
5e29a5
diff --git a/WHATS_NEW b/WHATS_NEW
5e29a5
index 6560357..e3eee56 100644
5e29a5
--- a/WHATS_NEW
5e29a5
+++ b/WHATS_NEW
5e29a5
@@ -1,5 +1,6 @@
5e29a5
 Version 2.02.182 - 
5e29a5
 ==============================
5e29a5
+  Fix lvconvert raid0/raid0_meta -> striped regression.
5e29a5
   Fix lvconvert --splitmirror for mirror type (2.02.178).
5e29a5
   Do not pair cache policy and cache metadata format.
5e29a5
 
5e29a5
diff --git a/lib/metadata/raid_manip.c b/lib/metadata/raid_manip.c
5e29a5
index 705a7f9..804f78b 100644
5e29a5
--- a/lib/metadata/raid_manip.c
5e29a5
+++ b/lib/metadata/raid_manip.c
5e29a5
@@ -6136,6 +6136,9 @@ static int _set_convenient_raid145610_segtype_to(const struct lv_segment *seg_fr
5e29a5
 		if (seg_from->area_count == 1)
5e29a5
 			seg_flag = SEG_RAID1;
5e29a5
 
5e29a5
+		else if (seg_is_any_raid0(seg_from) && segtype_is_striped(*segtype))
5e29a5
+			;
5e29a5
+
5e29a5
 		/* If this is any raid5 conversion request -> enforce raid5_n, because we convert from striped */
5e29a5
 		else if (((segtype_is_striped(*segtype) && !segtype_is_any_raid0(*segtype)) || segtype_is_any_raid5(*segtype)) &&
5e29a5
 			 !segtype_is_raid5_n(*segtype))
5e29a5
diff --git a/test/shell/lvconvert-raid0-striped.sh b/test/shell/lvconvert-raid0-striped.sh
5e29a5
new file mode 100644
5e29a5
index 0000000..4521b34
5e29a5
--- /dev/null
5e29a5
+++ b/test/shell/lvconvert-raid0-striped.sh
5e29a5
@@ -0,0 +1,25 @@
5e29a5
+#!/usr/bin/env bash
5e29a5
+
5e29a5
+# Copyright (C) 2018 Red Hat, Inc. All rights reserved.
5e29a5
+#
5e29a5
+# This copyrighted material is made available to anyone wishing to use,
5e29a5
+# modify, copy, or redistribute it subject to the terms and conditions
5e29a5
+# of the GNU General Public License v.2.
5e29a5
+#
5e29a5
+# You should have received a copy of the GNU General Public License
5e29a5
+# along with this program; if not, write to the Free Software Foundation,
5e29a5
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
5e29a5
+
5e29a5
+
5e29a5
+SKIP_WITH_LVMPOLLD=1
5e29a5
+
5e29a5
+. lib/inittest
5e29a5
+
5e29a5
+aux have_raid 1 7 0 || skip
5e29a5
+
5e29a5
+aux prepare_vg 3 16
5e29a5
+
5e29a5
+lvcreate -aey --type raid0 -i 3 -l3 -n $lv $vg
5e29a5
+lvconvert -y --type striped $vg/$lv
5e29a5
+check lv_field $vg/$lv segtype "striped"
5e29a5
+vgremove -ff $vg