diff options
author | Hou Tao <houtao1@huawei.com> | 2018-01-11 14:49:30 +0800 |
---|---|---|
committer | Eryu Guan <eguan@redhat.com> | 2018-01-12 11:40:39 +0800 |
commit | 976c9ca6561ce5fc4a62c6cab1ecad0a92a98511 (patch) | |
tree | 76f67b864191d3f9ee29aa6f8f49d81bc7266582 | |
parent | 2931de473cc18a8f866fa0a08805d50ed0f4079b (diff) | |
download | xfstests-dev-976c9ca6561ce5fc4a62c6cab1ecad0a92a98511.tar.gz |
dmflakey: support multiple dm targets for a dm-flakey device
dm-flakey can be used to emulate IO write error, however, when we
also need to prevent the IO error for a specific range of the block
device (eg., the log region of a XFS), we need to specify multiple
dm targets for the dm device.
Option --table can not accommodate the multiple dm targets case, so
let dmsetup get the possible-multiple-targets table from standard
input.
Signed-off-by: Hou Tao <houtao1@huawei.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
-rw-r--r-- | common/dmflakey | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/common/dmflakey b/common/dmflakey index 4434307ea7..e34fce85ca 100644 --- a/common/dmflakey +++ b/common/dmflakey @@ -77,11 +77,14 @@ _load_flakey_table() $DMSETUP_PROG suspend $suspend_opt flakey-test [ $? -ne 0 ] && _fatal "failed to suspend flakey-test" - $DMSETUP_PROG load flakey-test --table "$table" + # There may be multiple dm targets in the table, and these dm targets + # will be joined by the newline ("\n"). Option --table can not cope with + # the multiple-targets case, so get them by reading from standard input. + echo -e "$table" | $DMSETUP_PROG load flakey-test [ $? -ne 0 ] && _fatal "failed to load table into flakey-test" $DMSETUP_PROG resume flakey-test - [ $? -ne 0 ] && _fatal "failed to resumeflakey-test" + [ $? -ne 0 ] && _fatal "failed to resume flakey-test" } # Silently drop all writes and unmount/remount to simulate a crash/power |