} else
seg->segtype = new_segtype;
- seg->region_size = region_size;
+ seg->region_size = new_region_size ?: region_size;
if (!_lv_update_reload_fns_reset_eliminate_lvs(lv, &removal_lvs))
return_0;
static int _takeover_from_mirrored_to_raid1(TAKEOVER_FN_ARGS)
{
+ first_seg(lv)->region_size = new_region_size;
+
return _convert_mirror_to_raid1(lv, new_segtype);
}
static int _takeover_from_raid45_to_raid54(TAKEOVER_FN_ARGS)
{
- return _raid45_to_raid54_wrapper(lv, new_segtype, yes, force, first_seg(lv)->area_count, 2 /* data_copies */, 0, 0, 0, allocate_pvs);
+ return _raid45_to_raid54_wrapper(lv, new_segtype, yes, force, first_seg(lv)->area_count,
+ 2 /* data_copies */, 0, 0, new_region_size, allocate_pvs);
}
static int _takeover_from_raid45_to_raid6(TAKEOVER_FN_ARGS)
const unsigned new_stripes,
const unsigned new_stripe_size_supplied,
const unsigned new_stripe_size,
- const uint32_t new_region_size,
+ /* FIXME: workaround with volatile new_region_size until cli validation patches got merged */
+ uint32_t new_region_size,
struct dm_list *allocate_pvs)
{
struct lv_segment *seg = first_seg(lv);
return_0;
/* Change RAID region size */
- if (new_region_size && new_region_size != seg->region_size)
- return _region_size_change_requested(lv, yes, new_region_size);
+ /*
+ * FIXME: workaround with volatile new_region_size until the
+ * cli validation patches got merged when we'll change
+ * the API to have new_region_size_supplied to check for.
+ */
+ if (new_region_size) {
+ if (new_segtype == seg->segtype &&
+ new_region_size != seg->region_size &&
+ seg_is_raid(seg) && !seg_is_any_raid0(seg))
+ return _region_size_change_requested(lv, yes, new_region_size);
+ } else
+ new_region_size = seg->region_size ? : get_default_region_size(lv->vg->cmd);
/*
* Check acceptible options mirrors, region_size,
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA2110-1301 USA
SKIP_WITH_LVMLOCKD=1
SKIP_WITH_LVMPOLLD=1
local stripes=$3
local vg=$4
local lv=$5
- local dont_wait=$6
+ local region_size=$6
+ local wait_and_check=1
+ local R=""
- lvconvert -y --ty $req_level $vg/$lv
+ [ -n "$region_size" ] && R="-R $region_size"
+ [ "${level:0:7}" = "striped" ] && wait_and_check=0
+ [ "${level:0:5}" = "raid0" ] && wait_and_check=0
+
+
+ lvconvert -y --ty $req_level $R $vg/$lv
[ $? -ne 0 ] && return $?
check lv_field $vg/$lv segtype "$level"
check lv_field $vg/$lv stripes $stripes
- if [ -z "$dont_wait" ]
+ if [ "$wait_and_check" -eq 1 ]
then
fsck -fn /dev/mapper/$vg-$lv
aux wait_for_sync $vg $lv
function _invalid_raid5_conversions
{
- local lv=$1
- local vg=$2
+ local vg=$1
+ local lv=$2
not _lvconvert striped 4 $vg $lv1
not _lvconvert raid0 raid0 4 $vg $lv1
not _lvconvert raid6 raid6_n_6 6 $vg $lv1
}
-# Delay 1st leg so that rebuilding status characters
+# Delayst leg so that rebuilding status characters
# can be read before resync finished too quick.
-# aux delay_dev "$dev1" 0 1
+# aux delay_dev "$dev1" 1
# Create 3-way mirror
-lvcreate --yes -aey --type mirror -m 2 -L 64M -n $lv1 $vg
+lvcreate --yes -aey --type mirror -R 64K -m 2 -L 64M -n $lv1 $vg
check lv_field $vg/$lv1 segtype "mirror"
check lv_field $vg/$lv1 stripes 3
+check lv_field $vg/$lv1 regionsize "64.00k"
echo y | mkfs -t ext4 /dev/mapper/$vg-$lv1
aux wait_for_sync $vg $lv1
fsck -fn /dev/mapper/$vg-$lv1
fsck -fn /dev/mapper/$vg-$lv1
# Takeover 4-way mirror to raid1
-lvconvert --yes --type raid1 $vg/$lv1
+lvconvert --yes --type raid1 -R 64k $vg/$lv1
check lv_field $vg/$lv1 segtype "raid1"
check lv_field $vg/$lv1 stripes 4
+check lv_field $vg/$lv1 regionsize "64.00k"
fsck -fn /dev/mapper/$vg-$lv1
## Convert 4-way raid1 to 5-way
-lvconvert -m 4 $vg/$lv1
+lvconvert -m 4 -R 128K $vg/$lv1
check lv_field $vg/$lv1 segtype "raid1"
check lv_field $vg/$lv1 stripes 5
+# FIXME: once lv_raid_chanage_image_count() supports region_size changes
+not check lv_field $vg/$lv1 regionsize "128.00k"
fsck -fn /dev/mapper/$vg-$lv1
aux wait_for_sync $vg $lv1
fsck -fn /dev/mapper/$vg-$lv1
fsck -fn /dev/mapper/$vg-$lv1
# Convert 2-way raid1 to mirror
-lvconvert --yes --type mirror $vg/$lv1
+lvconvert --yes --type mirror -R 32K $vg/$lv1
check lv_field $vg/$lv1 segtype "mirror"
check lv_field $vg/$lv1 stripes 2
+check lv_field $vg/$lv1 regionsize "32.00k"
aux wait_for_sync $vg $lv1
fsck -fn /dev/mapper/$vg-$lv1
aux wait_for_sync $vg $lv1
aux wait_for_sync $vg $lv1
# Convert raid4 -> striped
-_lvconvert striped striped 3 $vg $lv1 1
+_lvconvert striped striped 3 $vg $lv1
# Convert striped -> raid4
-_lvconvert raid4 raid4 4 $vg $lv1
+_lvconvert raid4 raid4 4 $vg $lv1 64k
+check lv_field $vg/$lv1 regionsize "64.00k"
# Convert raid4 -> raid5_n
-_lvconvert raid5 raid5_n 4 $vg $lv1 1
+_lvconvert raid5 raid5_n 4 $vg $lv1 128k
+check lv_field $vg/$lv1 regionsize "128.00k"
# Convert raid5_n -> striped
-_lvconvert striped striped 3 $vg $lv1 1
+_lvconvert striped striped 3 $vg $lv1
# Convert striped -> raid5_n
_lvconvert raid5_n raid5_n 4 $vg $lv1
# Convert raid5_n -> raid4
-_lvconvert raid4 raid4 4 $vg $lv1 1
+_lvconvert raid4 raid4 4 $vg $lv1
# Convert raid4 -> raid0
-_lvconvert raid0 raid0 3 $vg $lv1 1
+_lvconvert raid0 raid0 3 $vg $lv1
# Convert raid0 -> raid5_n
_lvconvert raid5_n raid5_n 4 $vg $lv1
# Convert raid5_n -> raid0_meta
-_lvconvert raid0_meta raid0_meta 3 $vg $lv1 1
+_lvconvert raid0_meta raid0_meta 3 $vg $lv1
# Convert raid0_meta -> raid5_n
_lvconvert raid5 raid5_n 4 $vg $lv1
# Convert raid4 -> raid0_meta
-_lvconvert raid0_meta raid0_meta 3 $vg $lv1 1
+_lvconvert raid0_meta raid0_meta 3 $vg $lv1
# Convert raid0_meta -> raid4
_lvconvert raid4 raid4 4 $vg $lv1
# Convert raid4 -> raid0
-_lvconvert raid0 raid0 3 $vg $lv1 1
+_lvconvert raid0 raid0 3 $vg $lv1
# Convert raid0 -> raid4
_lvconvert raid4 raid4 4 $vg $lv1
# Convert raid4 -> striped
-_lvconvert striped striped 3 $vg $lv1 1
+_lvconvert striped striped 3 $vg $lv1
# Convert striped -> raid6_n_6
_lvconvert raid6_n_6 raid6_n_6 5 $vg $lv1
# Convert raid6_n_6 -> striped
-_lvconvert striped striped 3 $vg $lv1 1
+_lvconvert striped striped 3 $vg $lv1
# Convert striped -> raid6_n_6
_lvconvert raid6 raid6_n_6 5 $vg $lv1
# Convert raid6_n_6 -> raid5_n
-_lvconvert raid5_n raid5_n 4 $vg $lv1 1
+_lvconvert raid5_n raid5_n 4 $vg $lv1
# Convert raid5_n -> raid6_n_6
_lvconvert raid6_n_6 raid6_n_6 5 $vg $lv1
# Convert raid6_n_6 -> raid4
-_lvconvert raid4 raid4 4 $vg $lv1 1
+_lvconvert raid4 raid4 4 $vg $lv1
# Convert raid4 -> raid6_n_6
_lvconvert raid6 raid6_n_6 5 $vg $lv1
# Convert raid6_n_6 -> raid0
-_lvconvert raid0 raid0 3 $vg $lv1 1
+_lvconvert raid0 raid0 3 $vg $lv1
# Convert raid0 -> raid6_n_6
_lvconvert raid6_n_6 raid6_n_6 5 $vg $lv1
# Convert raid6_n_6 -> raid0_meta
-_lvconvert raid0_meta raid0_meta 3 $vg $lv1 1
+_lvconvert raid0_meta raid0_meta 3 $vg $lv1
# Convert raid0_meta -> raid6_n_6
_lvconvert raid6 raid6_n_6 5 $vg $lv1
not _lvconvert raid6_la_6 raid6_la_6 6 $vg $lv1
not _lvconvert raid6_ra_6 raid6_ra_6 6 $vg $lv1
_lvconvert raid6_ls_6 raid6_ls_6 6 $vg $lv1
-_lvconvert raid5_ls raid5_ls 5 $vg $lv1 1
+_lvconvert raid5_ls raid5_ls 5 $vg $lv1
lvremove -y $vg
_lvcreate raid5_ls 4 5 64M $vg $lv1
not _lvconvert raid6_la_6 raid6_la_6 6 $vg $lv1
not _lvconvert raid6_ra_6 raid6_ra_6 6 $vg $lv1
_lvconvert raid6_ls_6 raid6_ls_6 6 $vg $lv1
-_lvconvert raid5_ls raid5_ls 5 $vg $lv1 1
+_lvconvert raid5_ls raid5_ls 5 $vg $lv1
lvremove -y $vg
_lvcreate raid5_rs 4 5 64M $vg $lv1
not _lvconvert raid6_la_6 raid6_la_6 6 $vg $lv1
not _lvconvert raid6_ra_6 raid6_ra_6 6 $vg $lv1
_lvconvert raid6_rs_6 raid6_rs_6 6 $vg $lv1
-_lvconvert raid5_rs raid5_rs 5 $vg $lv1 1
+_lvconvert raid5_rs raid5_rs 5 $vg $lv1
lvremove -y $vg
_lvcreate raid5_la 4 5 64M $vg $lv1
not _lvconvert raid6_rs_6 raid6_rs_6 6 $vg $lv1
not _lvconvert raid6_ra_6 raid6_ra_6 6 $vg $lv1
_lvconvert raid6_la_6 raid6_la_6 6 $vg $lv1
-_lvconvert raid5_la raid5_la 5 $vg $lv1 1
+_lvconvert raid5_la raid5_la 5 $vg $lv1
lvremove -y $vg
_lvcreate raid5_ra 4 5 64M $vg $lv1
not _lvconvert raid6_rs_6 raid6_rs_6 6 $vg $lv1
not _lvconvert raid6_la_6 raid6_la_6 6 $vg $lv1
_lvconvert raid6_ra_6 raid6_ra_6 6 $vg $lv1
-_lvconvert raid5_ra raid5_ra 5 $vg $lv1 1
+_lvconvert raid5_ra raid5_ra 5 $vg $lv1
lvremove -y $vg
else