From 7c7122a3b1482900f71168f7ce0fec176eb36f8a Mon Sep 17 00:00:00 2001 From: Heinz Mauelshagen Date: Fri, 21 Apr 2017 20:57:31 +0200 Subject: [PATCH] test: add upconvert allocation failure tests --- .../lvconvert-raid-takeover-alloc-failure.sh | 98 +++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 test/shell/lvconvert-raid-takeover-alloc-failure.sh diff --git a/test/shell/lvconvert-raid-takeover-alloc-failure.sh b/test/shell/lvconvert-raid-takeover-alloc-failure.sh new file mode 100644 index 000000000..7cb83786b --- /dev/null +++ b/test/shell/lvconvert-raid-takeover-alloc-failure.sh @@ -0,0 +1,98 @@ +#!/bin/sh +# Copyright (C) 017 Red Hat, Inc. All rights reserved. +# +# This copyrighted material is made available to anyone wishing to use, +# modify, copy, or redistribute it subject to the terms and conditions +# of the GNU General Public License v.2. +# +# 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, MA2110-1301 USA + +SKIP_WITH_LVMLOCKD=1 +SKIP_WITH_LVMPOLLD=1 + +. lib/inittest + +aux have_raid 1 9 1 || skip + +aux prepare_vg 6 + +function check_sub_lvs +{ + local vg=$1 + local lv=$2 + local end=$3 + + for s in `seq 0 $end` + do + check lv_exists $vg ${lv}_rmeta_$s + check lv_exists $vg ${lv}_rimage_$s + done +} + +function check_no_sub_lvs +{ + local vg=$1 + local lv=$2 + local start=$3 + local end=$4 + + for s in `seq $start $end` + do + check lv_not_exists $vg ${lv}_rmeta_$s + check lv_not_exists $vg ${lv}_rimage_$s + done +} + +# Check takover upconversion fails allocation errors nicely without leaving image pair remnants behind + +# 6-way striped: neither conversion to raid5 nor raid6 possible +lvcreate --yes --stripes 6 --size 4M --name $lv1 $vg +not lvconvert --yes --type raid5 $vg/$lv1 +check lv_field $vg/$lv1 segtype "striped" +check_no_sub_lvs $vg $lv1 0 5 + +not lvconvert --yes --type raid6 $vg/$lv1 +check lv_field $vg/$lv1 segtype "striped" +check_no_sub_lvs $vg $lv1 0 5 + +# raid0_meta conversion is possible +lvconvert --yes --type raid0_meta $vg/$lv1 +check lv_field $vg/$lv1 segtype "raid0_meta" +check_sub_lvs $vg $lv1 0 5 + +lvremove -y $vg + +# 5-way striped: conversion to raid5 possible but not to raid6 +lvcreate --yes --stripes 5 --size 4M --name $lv1 $vg +not lvconvert --yes --type raid6 $vg/$lv1 +check lv_field $vg/$lv1 segtype "striped" +check_no_sub_lvs $vg $lv1 0 5 + +lvconvert --yes --type raid5 $vg/$lv1 +check lv_field $vg/$lv1 segtype "raid5_n" +check lv_field $vg/$lv1 stripes 6 +check lv_field $vg/$lv1 datastripes 5 +check_sub_lvs $vg $lv1 0 5 + +lvremove -y $vg + +# 4-way striped: conversion to raid5 and raid6 possible +lvcreate --yes --stripes 4 --size 4M --name $lv1 $vg +lvconvert --yes --type raid5 $vg/$lv1 +check lv_field $vg/$lv1 segtype "raid5_n" +check lv_field $vg/$lv1 stripes 5 +check lv_field $vg/$lv1 datastripes 4 +check_sub_lvs $vg $lv1 0 4 +check_no_sub_lvs $vg $lv1 5 5 + +lvremove -y $vg +lvcreate --yes --stripes 4 --size 4M --name $lv1 $vg +lvconvert --yes --type raid6 $vg/$lv1 +check lv_field $vg/$lv1 segtype "raid6_n_6" +check lv_field $vg/$lv1 stripes 6 +check lv_field $vg/$lv1 datastripes 4 +check_sub_lvs $vg $lv1 0 5 + +vgremove -ff $vg -- 2.43.5