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>
$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