From 15c9eb903fb93e1c9c6b59f97da0e59857645b9d Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Tue, 20 Jan 2009 21:03:02 -0800 Subject: [PATCH] Add 4 basic file based testr configs --- scripts/Makefile.am | 5 ++++- scripts/zpool-config/file-raid0.sh | 4 ++-- scripts/zpool-config/file-raid10.sh | 34 +++++++++++++++++++++++++++++ scripts/zpool-config/file-raidz.sh | 31 ++++++++++++++++++++++++++ scripts/zpool-config/file-raidz2.sh | 31 ++++++++++++++++++++++++++ 5 files changed, 102 insertions(+), 3 deletions(-) create mode 100644 scripts/zpool-config/file-raid10.sh create mode 100644 scripts/zpool-config/file-raidz.sh create mode 100644 scripts/zpool-config/file-raidz2.sh diff --git a/scripts/Makefile.am b/scripts/Makefile.am index ef6579bbc6..5a191e99b0 100644 --- a/scripts/Makefile.am +++ b/scripts/Makefile.am @@ -3,5 +3,8 @@ EXTRA_DIST = common.sh zfs-update.sh zfs.sh zpool-create.sh check: ./zfs.sh -v - ./zpios.sh -c file-raid0 -t tiny -v + ./zpios.sh -c file-raid0 -t tiny + ./zpios.sh -c file-raid10 -t tiny + ./zpios.sh -c file-raidz -t tiny + ./zpios.sh -c file-raidz2 -t tiny ./zfs.sh -vu diff --git a/scripts/zpool-config/file-raid0.sh b/scripts/zpool-config/file-raid0.sh index 6333248213..02683fabcb 100644 --- a/scripts/zpool-config/file-raid0.sh +++ b/scripts/zpool-config/file-raid0.sh @@ -1,6 +1,6 @@ #!/bin/bash # -# 4 Device File Raid-0 Configuration +# 4 File Raid-0 Configuration # FILES="/tmp/zpool-vdev0 \ @@ -12,7 +12,7 @@ zpool_create() { for FILE in ${FILES}; do msg "Creating ${FILE}" rm -f ${FILE} || exit 1 - dd if=/dev/zero of=${FILE} bs=1024k count=256 status=noxfer &>/dev/null || + dd if=/dev/zero of=${FILE} bs=1024k count=256 &>/dev/null || die "Error $? creating ${FILE}" done diff --git a/scripts/zpool-config/file-raid10.sh b/scripts/zpool-config/file-raid10.sh new file mode 100644 index 0000000000..d3d2d82eb5 --- /dev/null +++ b/scripts/zpool-config/file-raid10.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# +# 4 File Raid-10 Configuration +# + +FILES_M1="/tmp/zpool-vdev0 \ + /tmp/zpool-vdev1" +FILES_M2="/tmp/zpool-vdev2 \ + /tmp/zpool-vdev3" +FILES="${FILES_M1} ${FILES_M2}" + +zpool_create() { + for FILE in ${FILES}; do + msg "Creating ${FILE}" + rm -f ${FILE} || exit 1 + dd if=/dev/zero of=${FILE} bs=1024k count=256 &>/dev/null || + die "Error $? creating ${FILE}" + done + + msg ${CMDDIR}/zpool/zpool create ${ZPOOL_NAME} \ + mirror ${FILES_M1} mirror ${FILES_M2} + ${CMDDIR}/zpool/zpool create ${ZPOOL_NAME} \ + mirror ${FILES_M1} mirror ${FILES_M2} || exit 1 +} + +zpool_destroy() { + msg ${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME} + ${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME} + + for FILE in ${FILES}; do + msg "Removing ${FILE}" + rm -f ${FILE} || exit 1 + done +} diff --git a/scripts/zpool-config/file-raidz.sh b/scripts/zpool-config/file-raidz.sh new file mode 100644 index 0000000000..6867489079 --- /dev/null +++ b/scripts/zpool-config/file-raidz.sh @@ -0,0 +1,31 @@ +#!/bin/bash +# +# 4 File Raid-Z Configuration +# + +FILES="/tmp/zpool-vdev0 \ + /tmp/zpool-vdev1 \ + /tmp/zpool-vdev2 \ + /tmp/zpool-vdev3" + +zpool_create() { + for FILE in ${FILES}; do + msg "Creating ${FILE}" + rm -f ${FILE} || exit 1 + dd if=/dev/zero of=${FILE} bs=1024k count=256 &>/dev/null || + die "Error $? creating ${FILE}" + done + + msg ${CMDDIR}/zpool/zpool create raidz ${ZPOOL_NAME} ${FILES} + ${CMDDIR}/zpool/zpool create raidz ${ZPOOL_NAME} ${FILES} || exit 1 +} + +zpool_destroy() { + msg ${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME} + ${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME} + + for FILE in ${FILES}; do + msg "Removing ${FILE}" + rm -f ${FILE} || exit 1 + done +} diff --git a/scripts/zpool-config/file-raidz2.sh b/scripts/zpool-config/file-raidz2.sh new file mode 100644 index 0000000000..09b20e4c9c --- /dev/null +++ b/scripts/zpool-config/file-raidz2.sh @@ -0,0 +1,31 @@ +#!/bin/bash +# +# 4 File Raid-Z2 Configuration +# + +FILES="/tmp/zpool-vdev0 \ + /tmp/zpool-vdev1 \ + /tmp/zpool-vdev2 \ + /tmp/zpool-vdev3" + +zpool_create() { + for FILE in ${FILES}; do + msg "Creating ${FILE}" + rm -f ${FILE} || exit 1 + dd if=/dev/zero of=${FILE} bs=1024k count=256 &>/dev/null || + die "Error $? creating ${FILE}" + done + + msg ${CMDDIR}/zpool/zpool create raidz2 ${ZPOOL_NAME} ${FILES} + ${CMDDIR}/zpool/zpool create raidz2 ${ZPOOL_NAME} ${FILES} || exit 1 +} + +zpool_destroy() { + msg ${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME} + ${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME} + + for FILE in ${FILES}; do + msg "Removing ${FILE}" + rm -f ${FILE} || exit 1 + done +}