Skip to contentSkip to conversation

master - TEST: Add library functions for checking and waiting for sync

PATCH Jonathan Brassow 1 participant 1 message Jul 24, 2012

lore
Share & tools
lore
#0 lore raw
Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=753cb9204d24ceb4d9f8184ceb4c0262b9aacb42
Commit:        753cb9204d24ceb4d9f8184ceb4c0262b9aacb42
Parent:        5e36b86c46f04eddae2d4b1f826e1f24995b3636
Author:        Jonathan Brassow <[email protected]>
AuthorDate:    Tue Jul 24 14:17:54 2012 -0500
Committer:     Jonathan Brassow <[email protected]>
CommitterDate: Tue Jul 24 14:17:54 2012 -0500

TEST: Add library functions for checking and waiting for sync

Add 'in_sync' and 'wait_for_sync' to test and wait for synchronization of a mirror or RAID logical volume.

---
 test/lib/aux.sh   |   12 ++++++++++++
 test/lib/check.sh |   45 +++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 57 insertions(+), 0 deletions(-)
test/lib/aux.sh +12 -0
index 91f54c9..4128f30 100644
@@ -479,6 +479,18 @@ udev_wait() {
 	fi
 }
 
+# wait_for_sync <VG/LV>
+wait_for_sync() {
+	local i
+	for i in {1..500} ; do
+		check in_sync $1 $2 && return
+		sleep .2
+	done
+
+	echo "Sync is taking too long - assume stuck"
+	return 1
+}
+
 #
 # Check wheter kernel [dm module] target exist
 # at least in expected version
test/lib/check.sh +45 -0

51 lines not on this page · raw message