From 5fbb2c1c4e9bb14c3cf5f4ec974cdb71daee9f7f Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Mon, 26 Oct 2009 10:41:06 -0700 Subject: [PATCH] Test configs for md, dm, and ramdisk style block devices For the sake of completeness we need to validate everything works well not just on IDE or SCSI drives. But we need to verify a zpool configured on top of the Linux virtual block devices. These scripts simply that testing process, and have shown that while everything is good on top of a ram disk. Right now the code base panics the kernel when layered on top of either an md or dm style device. For the moment don't do that. --- scripts/zpool-config/dm0-raid0.sh | 55 ++++++++++++++++++++++++++++++ scripts/zpool-config/md0-raid10.sh | 32 +++++++++++++++++ scripts/zpool-config/md0-raid5.sh | 32 +++++++++++++++++ scripts/zpool-config/ram0-raid0.sh | 16 +++++++++ 4 files changed, 135 insertions(+) create mode 100644 scripts/zpool-config/dm0-raid0.sh create mode 100644 scripts/zpool-config/md0-raid10.sh create mode 100644 scripts/zpool-config/md0-raid5.sh create mode 100644 scripts/zpool-config/ram0-raid0.sh diff --git a/scripts/zpool-config/dm0-raid0.sh b/scripts/zpool-config/dm0-raid0.sh new file mode 100644 index 0000000000..fa965ac019 --- /dev/null +++ b/scripts/zpool-config/dm0-raid0.sh @@ -0,0 +1,55 @@ +#!/bin/bash +# +# Four disk Raid-0 DM in a single Raid-0 Configuration +# + +PVCREATE=${PVCREATE:-/sbin/pvcreate} +PVREMOVE=${PVREMOVE:-/sbin/pvremove} +PVDEVICES=${PVDEVICES:-"/dev/sd[abcd]"} + +VGCREATE=${VGCREATE:-/sbin/vgcreate} +VGREMOVE=${VGREMOVE:-/sbin/vgremove} +VGNAME=${VGNAME:-"vg_tank"} + +LVCREATE=${LVCREATE:-/sbin/lvcreate} +LVREMOVE=${LVREMOVE:-/sbin/lvremove} +LVNAME=${LVNAME:-"lv_tank"} +LVSTRIPES=${LVSTRIPES:-4} +LVSIZE=${LVSIZE:-4G} + +DEVICES="/dev/${VGNAME}/${LVNAME}" + +zpool_create() { + # Remove EFI labels which cause pvcreate failure + for DEVICE in ${PVDEVICES}; do + dd if=/dev/urandom of=${DEVICE} bs=1k count=32 &>/dev/null + done + + msg ${PVCREATE} -f ${PVDEVICES} + ${PVCREATE} -f ${PVDEVICES} || exit 1 + + msg ${VGCREATE} ${VGNAME} ${PVDEVICES} + ${VGCREATE} ${VGNAME} ${PVDEVICES} || exit 2 + + msg ${LVCREATE} --size=${LVSIZE} --stripes=${LVSTRIPES} \ + --name=${LVNAME} ${VGNAME} + ${LVCREATE} --size=${LVSIZE} --stripes=${LVSTRIPES} \ + --name=${LVNAME} ${VGNAME} || exit 3 + + msg ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} ${DEVICES} + ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} ${DEVICES} || exit 4 +} + +zpool_destroy() { + msg ${ZPOOL} destroy ${ZPOOL_NAME} + ${ZPOOL} destroy ${ZPOOL_NAME} || exit 1 + + msg ${LVREMOVE} -f ${VGNAME}/${LVNAME} + ${LVREMOVE} -f ${VGNAME}/${LVNAME} || exit 2 + + msg ${VGREMOVE} -f ${VGNAME} + ${VGREMOVE} -f ${VGNAME} || exit 3 + + msg ${PVREMOVE} ${PVDEVICES} + ${PVREMOVE} ${PVDEVICES} || exit 4 +} diff --git a/scripts/zpool-config/md0-raid10.sh b/scripts/zpool-config/md0-raid10.sh new file mode 100644 index 0000000000..4b1a979041 --- /dev/null +++ b/scripts/zpool-config/md0-raid10.sh @@ -0,0 +1,32 @@ +#!/bin/bash +# +# Four disk Raid-10 in a single Raid-0 Configuration +# + +MDADM=${MDADM:-/sbin/mdadm} +MDDEVICES=${MDDEVICES:-"/dev/sd[abcd]"} +MDCOUNT=${MDCOUNT:-4} +MDRAID=${MDRAID:-10} + +DEVICES="/dev/md0" + +zpool_create() { + msg ${MDADM} --create ${DEVICES} --level=${MDRAID} \ + --raid-devices=${MDCOUNT} ${MDDEVICES} + ${MDADM} --create ${DEVICES} --level=${MDRAID} \ + --raid-devices=${MDCOUNT} ${MDDEVICES} || exit 1 + + msg ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} ${DEVICES} + ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} ${DEVICES} || exit 2 +} + +zpool_destroy() { + msg ${ZPOOL} destroy ${ZPOOL_NAME} + ${ZPOOL} destroy ${ZPOOL_NAME} || exit 1 + + msg ${MDADM} --manage --stop ${DEVICES} + ${MDADM} --manage --stop ${DEVICES} || exit 2 + + msg ${MDADM} --zero-superblock ${MDDEVICES} + ${MDADM} --zero-superblock ${MDDEVICES} || exit 3 +} diff --git a/scripts/zpool-config/md0-raid5.sh b/scripts/zpool-config/md0-raid5.sh new file mode 100644 index 0000000000..9bf17181b0 --- /dev/null +++ b/scripts/zpool-config/md0-raid5.sh @@ -0,0 +1,32 @@ +#!/bin/bash +# +# Four disk Raid-5 in a single Raid-0 Configuration +# + +MDADM=${MDADM:-/sbin/mdadm} +MDDEVICES=${MDDEVICES:-"/dev/sd[abcd]"} +MDCOUNT=${MDCOUNT:-4} +MDRAID=${MDRAID:-5} + +DEVICES="/dev/md0" + +zpool_create() { + msg ${MDADM} --create ${DEVICES} --level=${MDRAID} \ + --raid-devices=${MDCOUNT} ${MDDEVICES} + ${MDADM} --create ${DEVICES} --level=${MDRAID} \ + --raid-devices=${MDCOUNT} ${MDDEVICES} || exit 1 + + msg ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} ${DEVICES} + ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} ${DEVICES} || exit 2 +} + +zpool_destroy() { + msg ${ZPOOL} destroy ${ZPOOL_NAME} + ${ZPOOL} destroy ${ZPOOL_NAME} || exit 1 + + msg ${MDADM} --manage --stop ${DEVICES} + ${MDADM} --manage --stop ${DEVICES} || exit 2 + + msg ${MDADM} --zero-superblock ${MDDEVICES} + ${MDADM} --zero-superblock ${MDDEVICES} || exit 3 +} diff --git a/scripts/zpool-config/ram0-raid0.sh b/scripts/zpool-config/ram0-raid0.sh new file mode 100644 index 0000000000..b1939bfaae --- /dev/null +++ b/scripts/zpool-config/ram0-raid0.sh @@ -0,0 +1,16 @@ +#!/bin/bash +# +# Single ram disk /dev/ram0 Raid-0 Configuration +# + +DEVICES="/dev/ram0" + +zpool_create() { + msg ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} ${DEVICES} + ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} ${DEVICES} || exit 1 +} + +zpool_destroy() { + msg ${ZPOOL} destroy ${ZPOOL_NAME} + ${ZPOOL} destroy ${ZPOOL_NAME} || exit 1 +}