From 093219a6b333d9e04dde3cbb282d262016ad5ef6 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Tue, 22 Jul 2014 14:43:22 -0700 Subject: [PATCH] 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 Signed-off-by: Prakash Surya Closes #2524 --- scripts/zimport.sh | 2 +- scripts/zpool-config/dm0-raid0.sh | 4 ++-- scripts/zpool-config/file-raid0.sh | 4 ++-- scripts/zpool-config/file-raid10.sh | 4 ++-- scripts/zpool-config/file-raidz.sh | 4 ++-- scripts/zpool-config/file-raidz2.sh | 4 ++-- scripts/zpool-config/hda-raid0.sh | 4 ++-- scripts/zpool-config/lo-faulty-raid0.sh | 4 ++-- scripts/zpool-config/lo-faulty-raid10.sh | 4 ++-- scripts/zpool-config/lo-faulty-raidz.sh | 4 ++-- scripts/zpool-config/lo-faulty-raidz2.sh | 4 ++-- scripts/zpool-config/lo-faulty-raidz3.sh | 4 ++-- scripts/zpool-config/lo-raid0.sh | 4 ++-- scripts/zpool-config/lo-raid10.sh | 4 ++-- scripts/zpool-config/lo-raidz.sh | 4 ++-- scripts/zpool-config/lo-raidz2.sh | 4 ++-- scripts/zpool-config/md0-raid10.sh | 4 ++-- scripts/zpool-config/md0-raid5.sh | 4 ++-- scripts/zpool-config/ram0-raid0.sh | 4 ++-- scripts/zpool-config/scsi_debug-noraid.sh | 4 ++-- scripts/zpool-config/scsi_debug-raid0.sh | 4 ++-- scripts/zpool-config/scsi_debug-raid10.sh | 4 ++-- scripts/zpool-config/scsi_debug-raidz.sh | 4 ++-- scripts/zpool-config/scsi_debug-raidz2.sh | 4 ++-- scripts/zpool-config/scsi_debug-raidz3.sh | 4 ++-- scripts/zpool-config/sda-raid0.sh | 4 ++-- scripts/zpool-config/zpool-raid0.sh | 4 ++-- scripts/zpool-config/zpool-raid10.sh | 4 ++-- scripts/zpool-config/zpool-raidz.sh | 4 ++-- scripts/zpool-create.sh | 12 +++++++++--- 30 files changed, 66 insertions(+), 60 deletions(-) diff --git a/scripts/zimport.sh b/scripts/zimport.sh index 0e33e4b24..d702be579 100755 --- a/scripts/zimport.sh +++ b/scripts/zimport.sh @@ -237,7 +237,7 @@ pool_create() { # Create a file vdev RAIDZ pool. 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. $ZFS_CMD create $POOL_TAG/fs || fail 3 diff --git a/scripts/zpool-config/dm0-raid0.sh b/scripts/zpool-config/dm0-raid0.sh index 89f66e73a..f7fa8f60a 100644 --- a/scripts/zpool-config/dm0-raid0.sh +++ b/scripts/zpool-config/dm0-raid0.sh @@ -47,8 +47,8 @@ zpool_create() { ${LVCREATE} --size=${LVSIZE} --stripes=${LVSTRIPES} \ --name=${LVNAME} ${VGNAME} >/dev/null || exit 3 - msg ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} ${DEVICES} - ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} \ + msg ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} ${DEVICES} + ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} \ ${DEVICES} || (zpool_dm_destroy && exit 4) } diff --git a/scripts/zpool-config/file-raid0.sh b/scripts/zpool-config/file-raid0.sh index ff118361c..24b6aec4d 100644 --- a/scripts/zpool-config/file-raid0.sh +++ b/scripts/zpool-config/file-raid0.sh @@ -15,8 +15,8 @@ zpool_create() { &>/dev/null || die "Error $? creating ${FILE}" done - msg ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} ${FILES} - ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} ${FILES} || exit 1 + msg ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} ${FILES} + ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} ${FILES} || exit 1 } zpool_destroy() { diff --git a/scripts/zpool-config/file-raid10.sh b/scripts/zpool-config/file-raid10.sh index fa297b424..92b22c2fd 100644 --- a/scripts/zpool-config/file-raid10.sh +++ b/scripts/zpool-config/file-raid10.sh @@ -16,9 +16,9 @@ zpool_create() { &>/dev/null || die "Error $? creating ${FILE}" done - msg ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} \ + msg ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} \ 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 } diff --git a/scripts/zpool-config/file-raidz.sh b/scripts/zpool-config/file-raidz.sh index 768e3de89..4112deba7 100644 --- a/scripts/zpool-config/file-raidz.sh +++ b/scripts/zpool-config/file-raidz.sh @@ -15,8 +15,8 @@ zpool_create() { &>/dev/null || die "Error $? creating ${FILE}" done - msg ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} raidz ${FILES} - ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} raidz ${FILES} || exit 1 + msg ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} raidz ${FILES} + ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} raidz ${FILES} || exit 1 } zpool_destroy() { diff --git a/scripts/zpool-config/file-raidz2.sh b/scripts/zpool-config/file-raidz2.sh index b1c18f457..6e03da869 100644 --- a/scripts/zpool-config/file-raidz2.sh +++ b/scripts/zpool-config/file-raidz2.sh @@ -15,8 +15,8 @@ zpool_create() { &>/dev/null || die "Error $? creating ${FILE}" done - msg ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} raidz2 ${FILES} - ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} raidz2 ${FILES} || exit 1 + msg ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} raidz2 ${FILES} + ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} raidz2 ${FILES} || exit 1 } zpool_destroy() { diff --git a/scripts/zpool-config/hda-raid0.sh b/scripts/zpool-config/hda-raid0.sh index fb743fae5..0623963fd 100644 --- a/scripts/zpool-config/hda-raid0.sh +++ b/scripts/zpool-config/hda-raid0.sh @@ -6,8 +6,8 @@ DEVICES="/dev/hda" zpool_create() { - msg ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} ${DEVICES} - ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} ${DEVICES} || exit 1 + msg ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} ${DEVICES} + ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} ${DEVICES} || exit 1 } zpool_destroy() { diff --git a/scripts/zpool-config/lo-faulty-raid0.sh b/scripts/zpool-config/lo-faulty-raid0.sh index bf057bba1..72894ee23 100644 --- a/scripts/zpool-config/lo-faulty-raid0.sh +++ b/scripts/zpool-config/lo-faulty-raid0.sh @@ -58,8 +58,8 @@ zpool_create() { MDDEVICES="${MDDEVICES} ${MDDEVICE}" done - msg ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} ${MDDEVICES} - ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} ${MDDEVICES} || \ + msg ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} ${MDDEVICES} + ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} ${MDDEVICES} || \ (destroy_md_devices "${MDDEVICES}" && \ destroy_loop_devices "${LODEVICES}" && exit 1) diff --git a/scripts/zpool-config/lo-faulty-raid10.sh b/scripts/zpool-config/lo-faulty-raid10.sh index 0a3720ae1..1a523ec45 100644 --- a/scripts/zpool-config/lo-faulty-raid10.sh +++ b/scripts/zpool-config/lo-faulty-raid10.sh @@ -63,9 +63,9 @@ zpool_create() { fi done - msg ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} \ + msg ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} \ mirror ${MDDEVICES_M1} mirror ${MDDEVICES_M2} - ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} \ + ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} \ mirror ${MDDEVICES_M1} mirror ${MDDEVICES_M2} || \ (destroy_md_devices "${MDDEVICES}" && \ destroy_loop_devices "${LODEVICES}" && exit 1) diff --git a/scripts/zpool-config/lo-faulty-raidz.sh b/scripts/zpool-config/lo-faulty-raidz.sh index 07fd14559..c8f88b31f 100644 --- a/scripts/zpool-config/lo-faulty-raidz.sh +++ b/scripts/zpool-config/lo-faulty-raidz.sh @@ -52,8 +52,8 @@ zpool_create() { MDDEVICES="${MDDEVICES} ${MDDEVICE}" done - msg ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} raidz ${MDDEVICES} - ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} raidz ${MDDEVICES} || \ + msg ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} raidz ${MDDEVICES} + ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} raidz ${MDDEVICES} || \ (destroy_md_devices "${MDDEVICES}" && \ destroy_loop_devices "${LODEVICES}" && exit 1) diff --git a/scripts/zpool-config/lo-faulty-raidz2.sh b/scripts/zpool-config/lo-faulty-raidz2.sh index 4456a56e2..85b7d463a 100644 --- a/scripts/zpool-config/lo-faulty-raidz2.sh +++ b/scripts/zpool-config/lo-faulty-raidz2.sh @@ -52,8 +52,8 @@ zpool_create() { MDDEVICES="${MDDEVICES} ${MDDEVICE}" done - msg ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} raidz2 ${MDDEVICES} - ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} raidz2 ${MDDEVICES} || \ + msg ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} raidz2 ${MDDEVICES} + ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} raidz2 ${MDDEVICES} || \ (destroy_md_devices "${MDDEVICES}" && \ destroy_loop_devices "${LODEVICES}" && exit 1) diff --git a/scripts/zpool-config/lo-faulty-raidz3.sh b/scripts/zpool-config/lo-faulty-raidz3.sh index e5adaafc4..7836b5f49 100644 --- a/scripts/zpool-config/lo-faulty-raidz3.sh +++ b/scripts/zpool-config/lo-faulty-raidz3.sh @@ -53,8 +53,8 @@ zpool_create() { MDDEVICES="${MDDEVICES} ${MDDEVICE}" done - msg ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} raidz3 ${MDDEVICES} - ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} raidz3 ${MDDEVICES} || \ + msg ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} raidz3 ${MDDEVICES} + ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} raidz3 ${MDDEVICES} || \ (destroy_md_devices "${MDDEVICES}" && \ destroy_loop_devices "${LODEVICES}" && exit 1) diff --git a/scripts/zpool-config/lo-raid0.sh b/scripts/zpool-config/lo-raid0.sh index 1f23fe1ff..3f2cfe55e 100644 --- a/scripts/zpool-config/lo-raid0.sh +++ b/scripts/zpool-config/lo-raid0.sh @@ -22,8 +22,8 @@ zpool_create() { DEVICES="${DEVICES} ${DEVICE}" done - msg ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} ${DEVICES} - ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} ${DEVICES} || exit 1 + msg ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} ${DEVICES} + ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} ${DEVICES} || exit 1 } zpool_destroy() { diff --git a/scripts/zpool-config/lo-raid10.sh b/scripts/zpool-config/lo-raid10.sh index 18c1dcbfd..580ed1fb7 100644 --- a/scripts/zpool-config/lo-raid10.sh +++ b/scripts/zpool-config/lo-raid10.sh @@ -35,9 +35,9 @@ zpool_create() { DEVICES_M2="${DEVICES_M2} ${DEVICE}" done - msg ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} \ + msg ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} \ mirror ${DEVICES_M1} mirror ${DEVICES_M2} - ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} \ + ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} \ mirror ${DEVICES_M1} mirror ${DEVICES_M2} } diff --git a/scripts/zpool-config/lo-raidz.sh b/scripts/zpool-config/lo-raidz.sh index 483baf7b8..90b26c591 100644 --- a/scripts/zpool-config/lo-raidz.sh +++ b/scripts/zpool-config/lo-raidz.sh @@ -21,8 +21,8 @@ zpool_create() { DEVICES="${DEVICES} ${DEVICE}" done - msg ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} raidz ${DEVICES} - ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} raidz ${DEVICES} || exit 1 + msg ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} raidz ${DEVICES} + ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} raidz ${DEVICES} || exit 1 } zpool_destroy() { diff --git a/scripts/zpool-config/lo-raidz2.sh b/scripts/zpool-config/lo-raidz2.sh index ea52236d3..9e58b2a17 100644 --- a/scripts/zpool-config/lo-raidz2.sh +++ b/scripts/zpool-config/lo-raidz2.sh @@ -22,8 +22,8 @@ zpool_create() { DEVICES="${DEVICES} ${DEVICE}" done - msg ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} raidz2 ${DEVICES} - ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} raidz2 ${DEVICES} || exit 1 + msg ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} raidz2 ${DEVICES} + ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} raidz2 ${DEVICES} || exit 1 } zpool_destroy() { diff --git a/scripts/zpool-config/md0-raid10.sh b/scripts/zpool-config/md0-raid10.sh index ccc717015..65cae6a26 100644 --- a/scripts/zpool-config/md0-raid10.sh +++ b/scripts/zpool-config/md0-raid10.sh @@ -25,8 +25,8 @@ zpool_create() { --raid-devices=${MDCOUNT} ${MDDEVICES} \ &>/dev/null || (zpool_md_destroy && exit 1) - msg ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} ${DEVICES} - ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} \ + msg ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} ${DEVICES} + ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} \ ${DEVICES} || (zpool_md_destroy && exit 2) } diff --git a/scripts/zpool-config/md0-raid5.sh b/scripts/zpool-config/md0-raid5.sh index b5b22fe7a..373034bd3 100644 --- a/scripts/zpool-config/md0-raid5.sh +++ b/scripts/zpool-config/md0-raid5.sh @@ -25,8 +25,8 @@ zpool_create() { --raid-devices=${MDCOUNT} ${MDDEVICES} \ &>/dev/null || (zpool_md_destroy && exit 1) - msg ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} ${DEVICES} - ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} \ + msg ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} ${DEVICES} + ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} \ ${DEVICES} || (zpool_md_destroy && exit 2) } diff --git a/scripts/zpool-config/ram0-raid0.sh b/scripts/zpool-config/ram0-raid0.sh index b1939bfaa..801c912ca 100644 --- a/scripts/zpool-config/ram0-raid0.sh +++ b/scripts/zpool-config/ram0-raid0.sh @@ -6,8 +6,8 @@ DEVICES="/dev/ram0" zpool_create() { - msg ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} ${DEVICES} - ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} ${DEVICES} || exit 1 + msg ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} ${DEVICES} + ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} ${DEVICES} || exit 1 } zpool_destroy() { diff --git a/scripts/zpool-config/scsi_debug-noraid.sh b/scripts/zpool-config/scsi_debug-noraid.sh index dfcf1586c..c508ffbf1 100644 --- a/scripts/zpool-config/scsi_debug-noraid.sh +++ b/scripts/zpool-config/scsi_debug-noraid.sh @@ -33,8 +33,8 @@ zpool_create() { ${PARTED} -s ${SDDEVICE} mklabel gpt || \ (${RMMOD} scsi_debug && die "Error $? creating gpt label") - msg "${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} ${SDDEVICE}" - ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} ${SDDEVICE} || \ + msg "${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} ${SDDEVICE}" + ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} ${SDDEVICE} || \ (${RMMOD} scsi_debug && exit 1) } diff --git a/scripts/zpool-config/scsi_debug-raid0.sh b/scripts/zpool-config/scsi_debug-raid0.sh index fc0979817..66720852b 100644 --- a/scripts/zpool-config/scsi_debug-raid0.sh +++ b/scripts/zpool-config/scsi_debug-raid0.sh @@ -56,8 +56,8 @@ zpool_create() { DEVICES="${DEVICES} ${SDDEVICE}" - msg "${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} ${DEVICES}" - ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} ${DEVICES} || \ + msg "${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} ${DEVICES}" + ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} ${DEVICES} || \ (${RMMOD} scsi_debug && exit 1) } diff --git a/scripts/zpool-config/scsi_debug-raid10.sh b/scripts/zpool-config/scsi_debug-raid10.sh index 3c1f73360..caff1a0f6 100644 --- a/scripts/zpool-config/scsi_debug-raid10.sh +++ b/scripts/zpool-config/scsi_debug-raid10.sh @@ -68,9 +68,9 @@ zpool_create() { fi done - msg "${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} " \ + msg "${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} " \ "mirror ${DEVICES_M1} mirror ${DEVICES_M2}" - ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} \ + ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} \ mirror ${DEVICES_M1} mirror ${DEVICES_M2} || \ (${RMMOD} scsi_debug && exit 1) } diff --git a/scripts/zpool-config/scsi_debug-raidz.sh b/scripts/zpool-config/scsi_debug-raidz.sh index 54a456524..bc22d1004 100644 --- a/scripts/zpool-config/scsi_debug-raidz.sh +++ b/scripts/zpool-config/scsi_debug-raidz.sh @@ -56,8 +56,8 @@ zpool_create() { DEVICES="${DEVICES} ${SDDEVICE}" - msg "${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} raidz ${DEVICES}" - ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} raidz ${DEVICES} || \ + msg "${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} raidz ${DEVICES}" + ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} raidz ${DEVICES} || \ (${RMMOD} scsi_debug && exit 1) } diff --git a/scripts/zpool-config/scsi_debug-raidz2.sh b/scripts/zpool-config/scsi_debug-raidz2.sh index fa6e77a09..67a6f243a 100644 --- a/scripts/zpool-config/scsi_debug-raidz2.sh +++ b/scripts/zpool-config/scsi_debug-raidz2.sh @@ -56,8 +56,8 @@ zpool_create() { DEVICES="${DEVICES} ${SDDEVICE}" - msg "${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} raidz2 ${DEVICES}" - ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} raidz2 ${DEVICES} || \ + msg "${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} raidz2 ${DEVICES}" + ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} raidz2 ${DEVICES} || \ (${RMMOD} scsi_debug && exit 1) } diff --git a/scripts/zpool-config/scsi_debug-raidz3.sh b/scripts/zpool-config/scsi_debug-raidz3.sh index 34654b5a8..d7ef2098e 100644 --- a/scripts/zpool-config/scsi_debug-raidz3.sh +++ b/scripts/zpool-config/scsi_debug-raidz3.sh @@ -57,8 +57,8 @@ zpool_create() { DEVICES="${DEVICES} ${SDDEVICE}" - msg "${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} raidz3 ${DEVICES}" - ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} raidz3 ${DEVICES} || \ + msg "${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} raidz3 ${DEVICES}" + ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} raidz3 ${DEVICES} || \ (${RMMOD} scsi_debug && exit 1) } diff --git a/scripts/zpool-config/sda-raid0.sh b/scripts/zpool-config/sda-raid0.sh index b11092466..48dc96d27 100644 --- a/scripts/zpool-config/sda-raid0.sh +++ b/scripts/zpool-config/sda-raid0.sh @@ -6,8 +6,8 @@ DEVICES="/dev/sda" zpool_create() { - msg ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} ${DEVICES} - ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} ${DEVICES} || exit 1 + msg ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} ${DEVICES} + ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} ${DEVICES} || exit 1 } zpool_destroy() { diff --git a/scripts/zpool-config/zpool-raid0.sh b/scripts/zpool-config/zpool-raid0.sh index 518aec6b9..c75775588 100644 --- a/scripts/zpool-config/zpool-raid0.sh +++ b/scripts/zpool-config/zpool-raid0.sh @@ -70,8 +70,8 @@ zpool_create() { raid0_setup ${RANKS} ${CHANNELS} ZPOOL_DEVICES="${RAID0S[*]} ${ZIL} ${L2ARC}" - msg ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} ${ZPOOL_DEVICES} - ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} ${ZPOOL_DEVICES} || exit 1 + msg ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} ${ZPOOL_DEVICES} + ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} ${ZPOOL_DEVICES} || exit 1 } zpool_destroy() { diff --git a/scripts/zpool-config/zpool-raid10.sh b/scripts/zpool-config/zpool-raid10.sh index b9c220f47..d71c4d366 100644 --- a/scripts/zpool-config/zpool-raid10.sh +++ b/scripts/zpool-config/zpool-raid10.sh @@ -75,8 +75,8 @@ zpool_create() { raid10_setup ${RANKS} ${CHANNELS} ZPOOL_DEVICES="${RAID10S[*]} ${ZIL} ${L2ARC}" - msg ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} ${ZPOOL_DEVICES} - ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} ${ZPOOL_DEVICES} || exit 1 + msg ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} ${ZPOOL_DEVICES} + ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} ${ZPOOL_DEVICES} || exit 1 } zpool_destroy() { diff --git a/scripts/zpool-config/zpool-raidz.sh b/scripts/zpool-config/zpool-raidz.sh index 027aec3d3..b3f21a003 100644 --- a/scripts/zpool-config/zpool-raidz.sh +++ b/scripts/zpool-config/zpool-raidz.sh @@ -77,8 +77,8 @@ zpool_create() { raidz_setup ${RANKS} ${CHANNELS} ZPOOL_DEVICES="${RAIDZS[*]} ${ZIL} ${L2ARC}" - msg ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} ${ZPOOL_DEVICES} - ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} ${ZPOOL_DEVICES} || exit 1 + msg ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} ${ZPOOL_DEVICES} + ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} ${ZPOOL_DEVICES} || exit 1 } zpool_destroy() { diff --git a/scripts/zpool-create.sh b/scripts/zpool-create.sh index d6b301e32..16ee67146 100755 --- a/scripts/zpool-create.sh +++ b/scripts/zpool-create.sh @@ -14,7 +14,7 @@ PROG=zpool-create.sh usage() { cat << EOF USAGE: -$0 [hvcp] +$0 [hvfxcp] DESCRIPTION: Create one of several predefined zpool configurations. @@ -23,6 +23,7 @@ OPTIONS: -h Show this message -v Verbose -f Force everything + -x Disable all zpool features -c Configuration for zpool -p Name for zpool -d Destroy zpool (default create) @@ -52,10 +53,11 @@ check_config() { ZPOOL_CONFIG=unknown ZPOOL_NAME=tank ZPOOL_DESTROY= +ZPOOL_FLAGS=${ZPOOL_FLAGS:-""} ZPOOL_OPTIONS="" ZFS_OPTIONS="" -while getopts 'hvfc:p:dl:s:' OPTION; do +while getopts 'hvfxc:p:dl:s:' OPTION; do case $OPTION in h) usage @@ -67,7 +69,11 @@ while getopts 'hvfc:p:dl:s:' OPTION; do ;; f) FORCE=1 - FORCE_FLAG="-f" + ZPOOL_FLAGS="$ZPOOL_FLAGS -f" + ;; + x) + NO_FEATURES=1 + ZPOOL_FLAGS="$ZPOOL_FLAGS -d" ;; c) ZPOOL_CONFIG=${ZPOOLDIR}/${OPTARG}.sh