summaryrefslogtreecommitdiff
path: root/tests/bcache/bcache_device_remove_3.ktest
diff options
context:
space:
mode:
authorBill Rozas <gjr@datera.io>2014-12-04 15:39:44 -0800
committerBill Rozas <gjr@datera.io>2014-12-04 15:39:44 -0800
commit42abb995c467b6705c42dd94564e3aa93117dfcd (patch)
treea27cf6a2f57a494795794050986eaf68c3fa2197 /tests/bcache/bcache_device_remove_3.ktest
parentb0a610af47e8864000193d81df7b7849191fe84d (diff)
Add a test for removing a device containing meta-data.
Change-Id: I93fe730fc5b74a0f92e8ef6b298355d0b79d1b3e
Diffstat (limited to 'tests/bcache/bcache_device_remove_3.ktest')
-rwxr-xr-xtests/bcache/bcache_device_remove_3.ktest63
1 files changed, 63 insertions, 0 deletions
diff --git a/tests/bcache/bcache_device_remove_3.ktest b/tests/bcache/bcache_device_remove_3.ktest
new file mode 100755
index 0000000..b6ee85e
--- /dev/null
+++ b/tests/bcache/bcache_device_remove_3.ktest
@@ -0,0 +1,63 @@
+#!/bin/bash
+
+require-lib bcache-test-libs.sh
+
+config-cache 16M,16M
+config-tier 512M
+config-bucket-size 64k
+config-block-size 4k
+config-volume 350M
+config-data-replicas 1
+# config-scratch-devs 16M
+
+config-timeout $(stress_timeout)
+
+main()
+{
+ setup_tracing 'bcache:*'
+
+ setup_bcache
+
+ DEVNAME=`ls -d /sys/fs/bcache/*/cache0`
+
+ test_fio
+
+ (
+ # 1. Remove the tier 0 device -- everything live
+ # should move to the other tier 0 device.
+
+ echo "Removing device $DEVNAME"
+ echo 1 > $DEVNAME/unregister
+
+ # 2. Wait for data motion and device removal to succeed
+ # This is a bounded loop sleeping by 1 until the
+ # device is removed
+
+ COUNTER=0
+
+ while [ $COUNTER -lt 60 ]; do
+ let COUNTER=COUNTER+1
+ if [ -a $DEVNAME ]; then
+ sleep 1
+ else
+ echo "Device $DEVNAME removed"
+ break
+ fi
+ done
+ ) &
+
+ test_antagonist
+ test_fio
+
+ SUCCESS=1
+
+ if [ -a $DEVNAME ]; then
+ SUCCESS=0
+ fi
+
+ stop_bcache
+
+ if [ $SUCCESS -eq 0 ]; then
+ exit 1
+ fi
+}