Skip to content

Commit

Permalink
Add default FILEDIR path to zpool-config scripts
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Tim Chase <[email protected]>
Signed-off-by: Brian Behlendorf <[email protected]>
Closes #2120
  • Loading branch information
behlendorf committed Feb 12, 2014
1 parent f12971e commit 99d3ece
Show file tree
Hide file tree
Showing 16 changed files with 45 additions and 61 deletions.
7 changes: 3 additions & 4 deletions scripts/zpool-config/file-raid0.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 3 additions & 4 deletions scripts/zpool-config/file-raid10.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
7 changes: 3 additions & 4 deletions scripts/zpool-config/file-raidz.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 3 additions & 4 deletions scripts/zpool-config/file-raidz2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 3 additions & 4 deletions scripts/zpool-config/lo-faulty-raid0.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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=""

Expand Down
8 changes: 4 additions & 4 deletions scripts/zpool-config/lo-faulty-raid10.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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=""
Expand Down
7 changes: 3 additions & 4 deletions scripts/zpool-config/lo-faulty-raidz.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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=""

Expand Down
7 changes: 3 additions & 4 deletions scripts/zpool-config/lo-faulty-raidz2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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=""

Expand Down
7 changes: 3 additions & 4 deletions scripts/zpool-config/lo-raid0.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
7 changes: 3 additions & 4 deletions scripts/zpool-config/lo-raid10.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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=""
Expand Down
8 changes: 3 additions & 5 deletions scripts/zpool-config/lo-raidz.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
7 changes: 3 additions & 4 deletions scripts/zpool-config/lo-raidz2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
5 changes: 2 additions & 3 deletions scripts/zpool-config/scsi_debug-raid0.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
5 changes: 2 additions & 3 deletions scripts/zpool-config/scsi_debug-raid10.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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=""

Expand Down
5 changes: 2 additions & 3 deletions scripts/zpool-config/scsi_debug-raidz.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
5 changes: 2 additions & 3 deletions scripts/zpool-config/scsi_debug-raidz2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit 99d3ece

Please sign in to comment.