All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zdenek Kabelac <zkabelac@sourceware.org>
To: lvm-devel@redhat.com
Subject: main - tests: workaround for some raid targets
Date: Wed, 17 Mar 2021 00:00:47 +0000 (GMT)	[thread overview]
Message-ID: <20210317000047.04A2D385481A@sourceware.org> (raw)

Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=e793ff1e185acfdbbbedb85a420d48527cd57c90
Commit:        e793ff1e185acfdbbbedb85a420d48527cd57c90
Parent:        db37905d7f59ac0057f6d50c34d8b1095c64d50f
Author:        Zdenek Kabelac <zkabelac@redhat.com>
AuthorDate:    Tue Mar 16 22:53:23 2021 +0100
Committer:     Zdenek Kabelac <zkabelac@redhat.com>
CommitterDate: Wed Mar 17 00:59:50 2021 +0100

tests: workaround for some raid targets

Problem with some target is that shortly after initialization it
returns incorrect status letters.
---
 test/shell/lvcreate-raid-nosync.sh | 23 +++++++++++++++++++----
 1 file changed, 19 insertions(+), 4 deletions(-)

diff --git a/test/shell/lvcreate-raid-nosync.sh b/test/shell/lvcreate-raid-nosync.sh
index dcc248e0c..05ab848a1 100644
--- a/test/shell/lvcreate-raid-nosync.sh
+++ b/test/shell/lvcreate-raid-nosync.sh
@@ -33,6 +33,21 @@ _sync() {
 	aux restore_from_devtable "$dev1"
 }
 
+# Workaround for raid targets returning 'a' shortly after initialization
+# TODO: maybe there is some workaround to be made on lvm side
+_check_raid_in_loop() {
+	local vg=$1
+	local lv=$2
+	local A=$3
+	local B=$(echo $A | tr A a)
+	for i in {1..10} ; do
+		check raid_leg_status $vg $lv ${A} && return 0
+		# Only when there is initial 'a..a' we will wait for a while
+		check raid_leg_status $vg $lv ${B} || break
+		sleep .05
+	done
+	die "Cannot get $A status for $vg/$lv";
+}
 
 # Delay 1st leg so that rebuilding status characters
 #  can be read before resync finished too quick.
@@ -42,7 +57,7 @@ aux delay_dev "$dev1" 0 100 "$(get first_extent_sector "$dev1")"
 for r in raid0 raid0_meta
 do
 	lvcreate --type $r -Zn -i 3 -l 1 -n $lv1 $vg
-	check raid_leg_status $vg $lv1 "AAA"
+	_check_raid_in_loop $vg $lv1 "AAA"
 	lvremove --yes $vg/$lv1
 done
 
@@ -53,7 +68,7 @@ _sync "AAA"
 
 # raid1 supports --nosync
 lvcreate --type raid1 --nosync -Zn -m 2 -l 1 -n $lv1 $vg
-check raid_leg_status $vg $lv1 "AAA"
+_check_raid_in_loop $vg $lv1 "AAA"
 lvremove --yes $vg/$lv1
 
 for r in $segtypes
@@ -65,7 +80,7 @@ do
 
 	# raid4/5 support --nosync
 	lvcreate --type $r -Zn --nosync -i 3 -l 1 -n $lv2 $vg
-	check raid_leg_status $vg $lv2 "AAAA"
+	_check_raid_in_loop $vg $lv2 "AAAA"
 	lvremove --yes $vg
 done
 
@@ -84,6 +99,6 @@ _sync "AAAAAA"
 
 # raid10 supports --nosync
 lvcreate --type raid10 --nosync -m 1 -Zn -i 3 -l 1 -n $lv1 $vg
-check raid_leg_status $vg $lv1 "AAAAAA"
+_check_raid_in_loop $vg $lv1 "AAAAAA"
 
 vgremove -ff $vg



                 reply	other threads:[~2021-03-17  0:00 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210317000047.04A2D385481A@sourceware.org \
    --to=zkabelac@sourceware.org \
    --cc=lvm-devel@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.