zpool-create.sh: allow features to be disabled

The zimport.sh script makes use of the zpool-create.sh script
to construct test pools for importing with older versions of
ZoL.  It is desirable to have a way to disable all the features
so new pools can be imported with older code.

The simplest and most flexible way to achieve this was to merge
the VERBOSE_FLAG and FORCE_FLAG in to a single ZPOOL_FLAGS
variable.  The contents of this variable will be used in the
'zpool create' allowing us to easily pass arbitrary flags.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Prakash Surya <surya1@llnl.gov>
Closes #2524
This commit is contained in:
Brian Behlendorf 2014-07-22 14:43:22 -07:00
parent 1139491da7
commit 093219a6b3
30 changed files with 66 additions and 60 deletions

View File

@ -237,7 +237,7 @@ pool_create() {
# Create a file vdev RAIDZ pool. # Create a file vdev RAIDZ pool.
FILEDIR="$POOL_DIR_PRISTINE" $ZPOOL_CREATE \ FILEDIR="$POOL_DIR_PRISTINE" $ZPOOL_CREATE \
-c file-raidz -p $POOL_TAG -v >/dev/null || fail 2 -c file-raidz -p $POOL_TAG -v -x >/dev/null || fail 2
# Create a pool/fs filesystem with some random contents. # Create a pool/fs filesystem with some random contents.
$ZFS_CMD create $POOL_TAG/fs || fail 3 $ZFS_CMD create $POOL_TAG/fs || fail 3

View File

@ -47,8 +47,8 @@ zpool_create() {
${LVCREATE} --size=${LVSIZE} --stripes=${LVSTRIPES} \ ${LVCREATE} --size=${LVSIZE} --stripes=${LVSTRIPES} \
--name=${LVNAME} ${VGNAME} >/dev/null || exit 3 --name=${LVNAME} ${VGNAME} >/dev/null || exit 3
msg ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} ${DEVICES} msg ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} ${DEVICES}
${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} \ ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} \
${DEVICES} || (zpool_dm_destroy && exit 4) ${DEVICES} || (zpool_dm_destroy && exit 4)
} }

View File

@ -15,8 +15,8 @@ zpool_create() {
&>/dev/null || die "Error $? creating ${FILE}" &>/dev/null || die "Error $? creating ${FILE}"
done done
msg ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} ${FILES} msg ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} ${FILES}
${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} ${FILES} || exit 1 ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} ${FILES} || exit 1
} }
zpool_destroy() { zpool_destroy() {

View File

@ -16,9 +16,9 @@ zpool_create() {
&>/dev/null || die "Error $? creating ${FILE}" &>/dev/null || die "Error $? creating ${FILE}"
done done
msg ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} \ msg ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} \
mirror ${FILES_M1} mirror ${FILES_M2} mirror ${FILES_M1} mirror ${FILES_M2}
${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} \ ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} \
mirror ${FILES_M1} mirror ${FILES_M2} || exit 1 mirror ${FILES_M1} mirror ${FILES_M2} || exit 1
} }

View File

@ -15,8 +15,8 @@ zpool_create() {
&>/dev/null || die "Error $? creating ${FILE}" &>/dev/null || die "Error $? creating ${FILE}"
done done
msg ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} raidz ${FILES} msg ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} raidz ${FILES}
${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} raidz ${FILES} || exit 1 ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} raidz ${FILES} || exit 1
} }
zpool_destroy() { zpool_destroy() {

View File

@ -15,8 +15,8 @@ zpool_create() {
&>/dev/null || die "Error $? creating ${FILE}" &>/dev/null || die "Error $? creating ${FILE}"
done done
msg ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} raidz2 ${FILES} msg ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} raidz2 ${FILES}
${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} raidz2 ${FILES} || exit 1 ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} raidz2 ${FILES} || exit 1
} }
zpool_destroy() { zpool_destroy() {

View File

@ -6,8 +6,8 @@
DEVICES="/dev/hda" DEVICES="/dev/hda"
zpool_create() { zpool_create() {
msg ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} ${DEVICES} msg ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} ${DEVICES}
${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} ${DEVICES} || exit 1 ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} ${DEVICES} || exit 1
} }
zpool_destroy() { zpool_destroy() {

View File

@ -58,8 +58,8 @@ zpool_create() {
MDDEVICES="${MDDEVICES} ${MDDEVICE}" MDDEVICES="${MDDEVICES} ${MDDEVICE}"
done done
msg ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} ${MDDEVICES} msg ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} ${MDDEVICES}
${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} ${MDDEVICES} || \ ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} ${MDDEVICES} || \
(destroy_md_devices "${MDDEVICES}" && \ (destroy_md_devices "${MDDEVICES}" && \
destroy_loop_devices "${LODEVICES}" && exit 1) destroy_loop_devices "${LODEVICES}" && exit 1)

View File

@ -63,9 +63,9 @@ zpool_create() {
fi fi
done done
msg ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} \ msg ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} \
mirror ${MDDEVICES_M1} mirror ${MDDEVICES_M2} mirror ${MDDEVICES_M1} mirror ${MDDEVICES_M2}
${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} \ ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} \
mirror ${MDDEVICES_M1} mirror ${MDDEVICES_M2} || \ mirror ${MDDEVICES_M1} mirror ${MDDEVICES_M2} || \
(destroy_md_devices "${MDDEVICES}" && \ (destroy_md_devices "${MDDEVICES}" && \
destroy_loop_devices "${LODEVICES}" && exit 1) destroy_loop_devices "${LODEVICES}" && exit 1)

View File

@ -52,8 +52,8 @@ zpool_create() {
MDDEVICES="${MDDEVICES} ${MDDEVICE}" MDDEVICES="${MDDEVICES} ${MDDEVICE}"
done done
msg ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} raidz ${MDDEVICES} msg ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} raidz ${MDDEVICES}
${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} raidz ${MDDEVICES} || \ ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} raidz ${MDDEVICES} || \
(destroy_md_devices "${MDDEVICES}" && \ (destroy_md_devices "${MDDEVICES}" && \
destroy_loop_devices "${LODEVICES}" && exit 1) destroy_loop_devices "${LODEVICES}" && exit 1)

View File

@ -52,8 +52,8 @@ zpool_create() {
MDDEVICES="${MDDEVICES} ${MDDEVICE}" MDDEVICES="${MDDEVICES} ${MDDEVICE}"
done done
msg ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} raidz2 ${MDDEVICES} msg ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} raidz2 ${MDDEVICES}
${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} raidz2 ${MDDEVICES} || \ ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} raidz2 ${MDDEVICES} || \
(destroy_md_devices "${MDDEVICES}" && \ (destroy_md_devices "${MDDEVICES}" && \
destroy_loop_devices "${LODEVICES}" && exit 1) destroy_loop_devices "${LODEVICES}" && exit 1)

View File

@ -53,8 +53,8 @@ zpool_create() {
MDDEVICES="${MDDEVICES} ${MDDEVICE}" MDDEVICES="${MDDEVICES} ${MDDEVICE}"
done done
msg ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} raidz3 ${MDDEVICES} msg ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} raidz3 ${MDDEVICES}
${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} raidz3 ${MDDEVICES} || \ ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} raidz3 ${MDDEVICES} || \
(destroy_md_devices "${MDDEVICES}" && \ (destroy_md_devices "${MDDEVICES}" && \
destroy_loop_devices "${LODEVICES}" && exit 1) destroy_loop_devices "${LODEVICES}" && exit 1)

View File

@ -22,8 +22,8 @@ zpool_create() {
DEVICES="${DEVICES} ${DEVICE}" DEVICES="${DEVICES} ${DEVICE}"
done done
msg ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} ${DEVICES} msg ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} ${DEVICES}
${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} ${DEVICES} || exit 1 ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} ${DEVICES} || exit 1
} }
zpool_destroy() { zpool_destroy() {

View File

@ -35,9 +35,9 @@ zpool_create() {
DEVICES_M2="${DEVICES_M2} ${DEVICE}" DEVICES_M2="${DEVICES_M2} ${DEVICE}"
done done
msg ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} \ msg ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} \
mirror ${DEVICES_M1} mirror ${DEVICES_M2} mirror ${DEVICES_M1} mirror ${DEVICES_M2}
${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} \ ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} \
mirror ${DEVICES_M1} mirror ${DEVICES_M2} mirror ${DEVICES_M1} mirror ${DEVICES_M2}
} }

View File

@ -21,8 +21,8 @@ zpool_create() {
DEVICES="${DEVICES} ${DEVICE}" DEVICES="${DEVICES} ${DEVICE}"
done done
msg ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} raidz ${DEVICES} msg ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} raidz ${DEVICES}
${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} raidz ${DEVICES} || exit 1 ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} raidz ${DEVICES} || exit 1
} }
zpool_destroy() { zpool_destroy() {

View File

@ -22,8 +22,8 @@ zpool_create() {
DEVICES="${DEVICES} ${DEVICE}" DEVICES="${DEVICES} ${DEVICE}"
done done
msg ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} raidz2 ${DEVICES} msg ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} raidz2 ${DEVICES}
${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} raidz2 ${DEVICES} || exit 1 ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} raidz2 ${DEVICES} || exit 1
} }
zpool_destroy() { zpool_destroy() {

View File

@ -25,8 +25,8 @@ zpool_create() {
--raid-devices=${MDCOUNT} ${MDDEVICES} \ --raid-devices=${MDCOUNT} ${MDDEVICES} \
&>/dev/null || (zpool_md_destroy && exit 1) &>/dev/null || (zpool_md_destroy && exit 1)
msg ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} ${DEVICES} msg ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} ${DEVICES}
${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} \ ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} \
${DEVICES} || (zpool_md_destroy && exit 2) ${DEVICES} || (zpool_md_destroy && exit 2)
} }

View File

@ -25,8 +25,8 @@ zpool_create() {
--raid-devices=${MDCOUNT} ${MDDEVICES} \ --raid-devices=${MDCOUNT} ${MDDEVICES} \
&>/dev/null || (zpool_md_destroy && exit 1) &>/dev/null || (zpool_md_destroy && exit 1)
msg ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} ${DEVICES} msg ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} ${DEVICES}
${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} \ ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} \
${DEVICES} || (zpool_md_destroy && exit 2) ${DEVICES} || (zpool_md_destroy && exit 2)
} }

View File

@ -6,8 +6,8 @@
DEVICES="/dev/ram0" DEVICES="/dev/ram0"
zpool_create() { zpool_create() {
msg ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} ${DEVICES} msg ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} ${DEVICES}
${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} ${DEVICES} || exit 1 ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} ${DEVICES} || exit 1
} }
zpool_destroy() { zpool_destroy() {

View File

@ -33,8 +33,8 @@ zpool_create() {
${PARTED} -s ${SDDEVICE} mklabel gpt || \ ${PARTED} -s ${SDDEVICE} mklabel gpt || \
(${RMMOD} scsi_debug && die "Error $? creating gpt label") (${RMMOD} scsi_debug && die "Error $? creating gpt label")
msg "${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} ${SDDEVICE}" msg "${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} ${SDDEVICE}"
${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} ${SDDEVICE} || \ ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} ${SDDEVICE} || \
(${RMMOD} scsi_debug && exit 1) (${RMMOD} scsi_debug && exit 1)
} }

View File

@ -56,8 +56,8 @@ zpool_create() {
DEVICES="${DEVICES} ${SDDEVICE}" DEVICES="${DEVICES} ${SDDEVICE}"
msg "${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} ${DEVICES}" msg "${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} ${DEVICES}"
${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} ${DEVICES} || \ ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} ${DEVICES} || \
(${RMMOD} scsi_debug && exit 1) (${RMMOD} scsi_debug && exit 1)
} }

View File

@ -68,9 +68,9 @@ zpool_create() {
fi fi
done done
msg "${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} " \ msg "${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} " \
"mirror ${DEVICES_M1} mirror ${DEVICES_M2}" "mirror ${DEVICES_M1} mirror ${DEVICES_M2}"
${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} \ ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} \
mirror ${DEVICES_M1} mirror ${DEVICES_M2} || \ mirror ${DEVICES_M1} mirror ${DEVICES_M2} || \
(${RMMOD} scsi_debug && exit 1) (${RMMOD} scsi_debug && exit 1)
} }

View File

@ -56,8 +56,8 @@ zpool_create() {
DEVICES="${DEVICES} ${SDDEVICE}" DEVICES="${DEVICES} ${SDDEVICE}"
msg "${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} raidz ${DEVICES}" msg "${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} raidz ${DEVICES}"
${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} raidz ${DEVICES} || \ ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} raidz ${DEVICES} || \
(${RMMOD} scsi_debug && exit 1) (${RMMOD} scsi_debug && exit 1)
} }

View File

@ -56,8 +56,8 @@ zpool_create() {
DEVICES="${DEVICES} ${SDDEVICE}" DEVICES="${DEVICES} ${SDDEVICE}"
msg "${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} raidz2 ${DEVICES}" msg "${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} raidz2 ${DEVICES}"
${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} raidz2 ${DEVICES} || \ ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} raidz2 ${DEVICES} || \
(${RMMOD} scsi_debug && exit 1) (${RMMOD} scsi_debug && exit 1)
} }

View File

@ -57,8 +57,8 @@ zpool_create() {
DEVICES="${DEVICES} ${SDDEVICE}" DEVICES="${DEVICES} ${SDDEVICE}"
msg "${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} raidz3 ${DEVICES}" msg "${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} raidz3 ${DEVICES}"
${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} raidz3 ${DEVICES} || \ ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} raidz3 ${DEVICES} || \
(${RMMOD} scsi_debug && exit 1) (${RMMOD} scsi_debug && exit 1)
} }

View File

@ -6,8 +6,8 @@
DEVICES="/dev/sda" DEVICES="/dev/sda"
zpool_create() { zpool_create() {
msg ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} ${DEVICES} msg ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} ${DEVICES}
${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} ${DEVICES} || exit 1 ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} ${DEVICES} || exit 1
} }
zpool_destroy() { zpool_destroy() {

View File

@ -70,8 +70,8 @@ zpool_create() {
raid0_setup ${RANKS} ${CHANNELS} raid0_setup ${RANKS} ${CHANNELS}
ZPOOL_DEVICES="${RAID0S[*]} ${ZIL} ${L2ARC}" ZPOOL_DEVICES="${RAID0S[*]} ${ZIL} ${L2ARC}"
msg ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} ${ZPOOL_DEVICES} msg ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} ${ZPOOL_DEVICES}
${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} ${ZPOOL_DEVICES} || exit 1 ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} ${ZPOOL_DEVICES} || exit 1
} }
zpool_destroy() { zpool_destroy() {

View File

@ -75,8 +75,8 @@ zpool_create() {
raid10_setup ${RANKS} ${CHANNELS} raid10_setup ${RANKS} ${CHANNELS}
ZPOOL_DEVICES="${RAID10S[*]} ${ZIL} ${L2ARC}" ZPOOL_DEVICES="${RAID10S[*]} ${ZIL} ${L2ARC}"
msg ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} ${ZPOOL_DEVICES} msg ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} ${ZPOOL_DEVICES}
${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} ${ZPOOL_DEVICES} || exit 1 ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} ${ZPOOL_DEVICES} || exit 1
} }
zpool_destroy() { zpool_destroy() {

View File

@ -77,8 +77,8 @@ zpool_create() {
raidz_setup ${RANKS} ${CHANNELS} raidz_setup ${RANKS} ${CHANNELS}
ZPOOL_DEVICES="${RAIDZS[*]} ${ZIL} ${L2ARC}" ZPOOL_DEVICES="${RAIDZS[*]} ${ZIL} ${L2ARC}"
msg ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} ${ZPOOL_DEVICES} msg ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} ${ZPOOL_DEVICES}
${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} ${ZPOOL_DEVICES} || exit 1 ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} ${ZPOOL_DEVICES} || exit 1
} }
zpool_destroy() { zpool_destroy() {

View File

@ -14,7 +14,7 @@ PROG=zpool-create.sh
usage() { usage() {
cat << EOF cat << EOF
USAGE: USAGE:
$0 [hvcp] $0 [hvfxcp]
DESCRIPTION: DESCRIPTION:
Create one of several predefined zpool configurations. Create one of several predefined zpool configurations.
@ -23,6 +23,7 @@ OPTIONS:
-h Show this message -h Show this message
-v Verbose -v Verbose
-f Force everything -f Force everything
-x Disable all zpool features
-c Configuration for zpool -c Configuration for zpool
-p Name for zpool -p Name for zpool
-d Destroy zpool (default create) -d Destroy zpool (default create)
@ -52,10 +53,11 @@ check_config() {
ZPOOL_CONFIG=unknown ZPOOL_CONFIG=unknown
ZPOOL_NAME=tank ZPOOL_NAME=tank
ZPOOL_DESTROY= ZPOOL_DESTROY=
ZPOOL_FLAGS=${ZPOOL_FLAGS:-""}
ZPOOL_OPTIONS="" ZPOOL_OPTIONS=""
ZFS_OPTIONS="" ZFS_OPTIONS=""
while getopts 'hvfc:p:dl:s:' OPTION; do while getopts 'hvfxc:p:dl:s:' OPTION; do
case $OPTION in case $OPTION in
h) h)
usage usage
@ -67,7 +69,11 @@ while getopts 'hvfc:p:dl:s:' OPTION; do
;; ;;
f) f)
FORCE=1 FORCE=1
FORCE_FLAG="-f" ZPOOL_FLAGS="$ZPOOL_FLAGS -f"
;;
x)
NO_FEATURES=1
ZPOOL_FLAGS="$ZPOOL_FLAGS -d"
;; ;;
c) c)
ZPOOL_CONFIG=${ZPOOLDIR}/${OPTARG}.sh ZPOOL_CONFIG=${ZPOOLDIR}/${OPTARG}.sh