From 99d3ece84797086407fbb4d94d3817f2dc891af0 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Tue, 4 Feb 2014 16:09:55 -0800 Subject: [PATCH] Add default FILEDIR path to zpool-config scripts Allow the caller of the zpool-create.sh script to override the default path where file vdevs are created. This allows for greated flexibilty when scripting. Additionally, update the default path from /tmp/ to /var/tmp/ because these days /tmp/ is likely a ramdisk. Even though these files are sparse they may grow large in which case they should be backed by a physical device. Signed-off-by: Richard Yao Signed-off-by: Tim Chase Signed-off-by: Brian Behlendorf Closes #2120 --- scripts/zpool-config/file-raid0.sh | 7 +++---- scripts/zpool-config/file-raid10.sh | 7 +++---- scripts/zpool-config/file-raidz.sh | 7 +++---- scripts/zpool-config/file-raidz2.sh | 7 +++---- scripts/zpool-config/lo-faulty-raid0.sh | 7 +++---- scripts/zpool-config/lo-faulty-raid10.sh | 8 ++++---- scripts/zpool-config/lo-faulty-raidz.sh | 7 +++---- scripts/zpool-config/lo-faulty-raidz2.sh | 7 +++---- scripts/zpool-config/lo-raid0.sh | 7 +++---- scripts/zpool-config/lo-raid10.sh | 7 +++---- scripts/zpool-config/lo-raidz.sh | 8 +++----- scripts/zpool-config/lo-raidz2.sh | 7 +++---- scripts/zpool-config/scsi_debug-raid0.sh | 5 ++--- scripts/zpool-config/scsi_debug-raid10.sh | 5 ++--- scripts/zpool-config/scsi_debug-raidz.sh | 5 ++--- scripts/zpool-config/scsi_debug-raidz2.sh | 5 ++--- 16 files changed, 45 insertions(+), 61 deletions(-) diff --git a/scripts/zpool-config/file-raid0.sh b/scripts/zpool-config/file-raid0.sh index 5ec80b05c1..ff118361c2 100644 --- a/scripts/zpool-config/file-raid0.sh +++ b/scripts/zpool-config/file-raid0.sh @@ -3,10 +3,9 @@ # 4 File Raid-0 Configuration # -FILES="/tmp/zpool-vdev0 \ - /tmp/zpool-vdev1 \ - /tmp/zpool-vdev2 \ - /tmp/zpool-vdev3" +FILEDIR=${FILEDIR:-/var/tmp} +FILES=${FILES:-"$FILEDIR/file-vdev0 $FILEDIR/file-vdev1 \ + $FILEDIR/file-vdev2 $FILEDIR/file-vdev3"} zpool_create() { for FILE in ${FILES}; do diff --git a/scripts/zpool-config/file-raid10.sh b/scripts/zpool-config/file-raid10.sh index ae7f0ae07b..fa297b424f 100644 --- a/scripts/zpool-config/file-raid10.sh +++ b/scripts/zpool-config/file-raid10.sh @@ -3,10 +3,9 @@ # 4 File Raid-10 Configuration # -FILES_M1="/tmp/zpool-vdev0 \ - /tmp/zpool-vdev1" -FILES_M2="/tmp/zpool-vdev2 \ - /tmp/zpool-vdev3" +FILEDIR=${FILEDIR:-/var/tmp} +FILES_M1=${FILES_M1:-"$FILEDIR/file-vdev0 $FILEDIR/file-vdev1"} +FILES_M2=${FILES_M2:-"$FILEDIR/file-vdev2 $FILEDIR/file-vdev3"} FILES="${FILES_M1} ${FILES_M2}" zpool_create() { diff --git a/scripts/zpool-config/file-raidz.sh b/scripts/zpool-config/file-raidz.sh index 5b6c3ea2c2..768e3de89e 100644 --- a/scripts/zpool-config/file-raidz.sh +++ b/scripts/zpool-config/file-raidz.sh @@ -3,10 +3,9 @@ # 4 File Raid-Z Configuration # -FILES="/tmp/zpool-vdev0 \ - /tmp/zpool-vdev1 \ - /tmp/zpool-vdev2 \ - /tmp/zpool-vdev3" +FILEDIR=${FILEDIR:-/var/tmp} +FILES=${FILES:-"$FILEDIR/file-vdev0 $FILEDIR/file-vdev1 \ + $FILEDIR/file-vdev2 $FILEDIR/file-vdev3"} zpool_create() { for FILE in ${FILES}; do diff --git a/scripts/zpool-config/file-raidz2.sh b/scripts/zpool-config/file-raidz2.sh index bc0e5ec8af..b1c18f4578 100644 --- a/scripts/zpool-config/file-raidz2.sh +++ b/scripts/zpool-config/file-raidz2.sh @@ -3,10 +3,9 @@ # 4 File Raid-Z2 Configuration # -FILES="/tmp/zpool-vdev0 \ - /tmp/zpool-vdev1 \ - /tmp/zpool-vdev2 \ - /tmp/zpool-vdev3" +FILEDIR=${FILEDIR:-/var/tmp} +FILES=${FILES:-"$FILEDIR/file-vdev0 $FILEDIR/file-vdev1 \ + $FILEDIR/file-vdev2 $FILEDIR/file-vdev3"} zpool_create() { for FILE in ${FILES}; do diff --git a/scripts/zpool-config/lo-faulty-raid0.sh b/scripts/zpool-config/lo-faulty-raid0.sh index 10b8f88bc6..bf057bba1c 100644 --- a/scripts/zpool-config/lo-faulty-raid0.sh +++ b/scripts/zpool-config/lo-faulty-raid0.sh @@ -9,10 +9,9 @@ # <--------------------- raid0 zpool ---------------------> # -FILES="/tmp/zpool-vdev0 \ - /tmp/zpool-vdev1 \ - /tmp/zpool-vdev2 \ - /tmp/zpool-vdev3" +FILEDIR=${FILEDIR:-/var/tmp} +FILES=${FILES:-"$FILEDIR/file-vdev0 $FILEDIR/file-vdev1 \ + $FILEDIR/file-vdev2 $FILEDIR/file-vdev3"} LODEVICES="" MDDEVICES="" diff --git a/scripts/zpool-config/lo-faulty-raid10.sh b/scripts/zpool-config/lo-faulty-raid10.sh index ef81abb9da..0a3720ae1c 100644 --- a/scripts/zpool-config/lo-faulty-raid10.sh +++ b/scripts/zpool-config/lo-faulty-raid10.sh @@ -9,10 +9,10 @@ # <--------------------- raid10 zpool ---------------------> # -FILES="/tmp/zpool-vdev0 \ - /tmp/zpool-vdev1 \ - /tmp/zpool-vdev2 \ - /tmp/zpool-vdev3" +FILEDIR=${FILEDIR:-/var/tmp} +FILES_M1=${FILES_M1:-"$FILEDIR/file-vdev0 $FILEDIR/file-vdev1"} +FILES_M2=${FILES_M2:-"$FILEDIR/file-vdev2 $FILEDIR/file-vdev3"} +FILES="${FILES_M1} ${FILES_M2}" LODEVICES="" MDDEVICES="" MDDEVICES_M1="" diff --git a/scripts/zpool-config/lo-faulty-raidz.sh b/scripts/zpool-config/lo-faulty-raidz.sh index 2f1f08aa65..07fd145593 100644 --- a/scripts/zpool-config/lo-faulty-raidz.sh +++ b/scripts/zpool-config/lo-faulty-raidz.sh @@ -9,10 +9,9 @@ # <--------------------- raidz zpool ---------------------> # -FILES="/tmp/zpool-vdev0 \ - /tmp/zpool-vdev1 \ - /tmp/zpool-vdev2 \ - /tmp/zpool-vdev3" +FILEDIR=${FILEDIR:-/var/tmp} +FILES=${FILES:-"$FILEDIR/file-vdev0 $FILEDIR/file-vdev1 \ + $FILEDIR/file-vdev2 $FILEDIR/file-vdev3"} LODEVICES="" MDDEVICES="" diff --git a/scripts/zpool-config/lo-faulty-raidz2.sh b/scripts/zpool-config/lo-faulty-raidz2.sh index 2522fa7e7d..4456a56e2f 100644 --- a/scripts/zpool-config/lo-faulty-raidz2.sh +++ b/scripts/zpool-config/lo-faulty-raidz2.sh @@ -9,10 +9,9 @@ # <--------------------- raidz2 zpool --------------------> # -FILES="/tmp/zpool-vdev0 \ - /tmp/zpool-vdev1 \ - /tmp/zpool-vdev2 \ - /tmp/zpool-vdev3" +FILEDIR=${FILEDIR:-/var/tmp} +FILES=${FILES:-"$FILEDIR/file-vdev0 $FILEDIR/file-vdev1 \ + $FILEDIR/file-vdev2 $FILEDIR/file-vdev3"} LODEVICES="" MDDEVICES="" diff --git a/scripts/zpool-config/lo-raid0.sh b/scripts/zpool-config/lo-raid0.sh index f24050f465..1f23fe1ff8 100644 --- a/scripts/zpool-config/lo-raid0.sh +++ b/scripts/zpool-config/lo-raid0.sh @@ -3,10 +3,9 @@ # 4 Device Loopback Raid-0 Configuration # -FILES="/tmp/zpool-vdev0 \ - /tmp/zpool-vdev1 \ - /tmp/zpool-vdev2 \ - /tmp/zpool-vdev3" +FILEDIR=${FILEDIR:-/var/tmp} +FILES=${FILES:-"$FILEDIR/file-vdev0 $FILEDIR/file-vdev1 \ + $FILEDIR/file-vdev2 $FILEDIR/file-vdev3"} DEVICES="" zpool_create() { diff --git a/scripts/zpool-config/lo-raid10.sh b/scripts/zpool-config/lo-raid10.sh index f9fe3c0646..18c1dcbfd8 100644 --- a/scripts/zpool-config/lo-raid10.sh +++ b/scripts/zpool-config/lo-raid10.sh @@ -3,10 +3,9 @@ # 4 Device Loopback Raid-0 Configuration # -FILES_M1="/tmp/zpool-vdev0 \ - /tmp/zpool-vdev1" -FILES_M2="/tmp/zpool-vdev2 \ - /tmp/zpool-vdev3" +FILEDIR=${FILEDIR:-/var/tmp} +FILES_M1=${FILES_M1:-"$FILEDIR/file-vdev0 $FILEDIR/file-vdev1"} +FILES_M2=${FILES_M2:-"$FILEDIR/file-vdev2 $FILEDIR/file-vdev3"} FILES="${FILES_M1} ${FILES_M2}" DEVICES_M1="" DEVICES_M2="" diff --git a/scripts/zpool-config/lo-raidz.sh b/scripts/zpool-config/lo-raidz.sh index db5de7c1bf..483baf7b89 100644 --- a/scripts/zpool-config/lo-raidz.sh +++ b/scripts/zpool-config/lo-raidz.sh @@ -2,11 +2,9 @@ # # 4 Device Loopback Raid-0 Configuration # - -FILES="/tmp/zpool-vdev0 \ - /tmp/zpool-vdev1 \ - /tmp/zpool-vdev2 \ - /tmp/zpool-vdev3" +FILEDIR=${FILEDIR:-/var/tmp} +FILES=${FILES:-"$FILEDIR/file-vdev0 $FILEDIR/file-vdev1 \ + $FILEDIR/file-vdev2 $FILEDIR/file-vdev3"} DEVICES="" zpool_create() { diff --git a/scripts/zpool-config/lo-raidz2.sh b/scripts/zpool-config/lo-raidz2.sh index 53a032ec5f..ea52236d33 100644 --- a/scripts/zpool-config/lo-raidz2.sh +++ b/scripts/zpool-config/lo-raidz2.sh @@ -3,10 +3,9 @@ # 4 Device Loopback Raid-0 Configuration # -FILES="/tmp/zpool-vdev0 \ - /tmp/zpool-vdev1 \ - /tmp/zpool-vdev2 \ - /tmp/zpool-vdev3" +FILEDIR=${FILEDIR:-/var/tmp} +FILES=${FILES:-"$FILEDIR/file-vdev0 $FILEDIR/file-vdev1 \ + $FILEDIR/file-vdev2 $FILEDIR/file-vdev3"} DEVICES="" zpool_create() { diff --git a/scripts/zpool-config/scsi_debug-raid0.sh b/scripts/zpool-config/scsi_debug-raid0.sh index 797ea8019d..fc09798172 100644 --- a/scripts/zpool-config/scsi_debug-raid0.sh +++ b/scripts/zpool-config/scsi_debug-raid0.sh @@ -9,9 +9,8 @@ SDHOSTS=${SDHOSTS:-1} SDTGTS=${SDTGTS:-1} SDLUNS=${SDLUNS:-1} LDMOD=/sbin/modprobe -FILES="/tmp/zpool-vdev0 \ - /tmp/zpool-vdev1 \ - /tmp/zpool-vdev2" +FILEDIR=${FILEDIR:-/var/tmp} +FILES=${FILES:-"$FILEDIR/file-vdev0 $FILEDIR/file-vdev1 $FILEDIR/file-vdev2"} DEVICES="" zpool_create() { diff --git a/scripts/zpool-config/scsi_debug-raid10.sh b/scripts/zpool-config/scsi_debug-raid10.sh index 4ec205b8b0..3c1f733605 100644 --- a/scripts/zpool-config/scsi_debug-raid10.sh +++ b/scripts/zpool-config/scsi_debug-raid10.sh @@ -9,9 +9,8 @@ SDHOSTS=${SDHOSTS:-1} SDTGTS=${SDTGTS:-1} SDLUNS=${SDLUNS:-1} LDMOD=/sbin/modprobe -FILES="/tmp/zpool-vdev0 \ - /tmp/zpool-vdev1 \ - /tmp/zpool-vdev2" +FILEDIR=${FILEDIR:-/var/tmp} +FILES=${FILES:-"$FILEDIR/file-vdev0 $FILEDIR/file-vdev1 $FILEDIR/file-vdev2"} DEVICES_M1="" DEVICES_M2="" diff --git a/scripts/zpool-config/scsi_debug-raidz.sh b/scripts/zpool-config/scsi_debug-raidz.sh index c811a01826..54a456524c 100644 --- a/scripts/zpool-config/scsi_debug-raidz.sh +++ b/scripts/zpool-config/scsi_debug-raidz.sh @@ -9,9 +9,8 @@ SDHOSTS=${SDHOSTS:-1} SDTGTS=${SDTGTS:-1} SDLUNS=${SDLUNS:-1} LDMOD=/sbin/modprobe -FILES="/tmp/zpool-vdev0 \ - /tmp/zpool-vdev1 \ - /tmp/zpool-vdev2" +FILEDIR=${FILEDIR:-/var/tmp} +FILES=${FILES:-"$FILEDIR/file-vdev0 $FILEDIR/file-vdev1 $FILEDIR/file-vdev2"} DEVICES="" zpool_create() { diff --git a/scripts/zpool-config/scsi_debug-raidz2.sh b/scripts/zpool-config/scsi_debug-raidz2.sh index 429a841435..fa6e77a09c 100644 --- a/scripts/zpool-config/scsi_debug-raidz2.sh +++ b/scripts/zpool-config/scsi_debug-raidz2.sh @@ -9,9 +9,8 @@ SDHOSTS=${SDHOSTS:-1} SDTGTS=${SDTGTS:-1} SDLUNS=${SDLUNS:-1} LDMOD=/sbin/modprobe -FILES="/tmp/zpool-vdev0 \ - /tmp/zpool-vdev1 \ - /tmp/zpool-vdev2" +FILEDIR=${FILEDIR:-/var/tmp} +FILES=${FILES:-"$FILEDIR/file-vdev0 $FILEDIR/file-vdev1 $FILEDIR/file-vdev2"} DEVICES="" zpool_create() {