-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow for '-o feature@<feature>=disabled' on the command line.
Sometimes it is desired to specifically disable a feature directly on the 'zpool create' command line. Signed-off-by: Turbo Fredriksson <turbo@bayour.com> Signed-off-by: loli10K <ezomori.nozomu@gmail.com>
- Loading branch information
Showing
7 changed files
with
140 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
97 changes: 97 additions & 0 deletions
97
tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_features_005_pos.ksh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
#!/bin/ksh -p | ||
# | ||
# CDDL HEADER START | ||
# | ||
# The contents of this file are subject to the terms of the | ||
# Common Development and Distribution License (the "License"). | ||
# You may not use this file except in compliance with the License. | ||
# | ||
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE | ||
# or http://www.opensolaris.org/os/licensing. | ||
# See the License for the specific language governing permissions | ||
# and limitations under the License. | ||
# | ||
# When distributing Covered Code, include this CDDL HEADER in each | ||
# file and include the License file at usr/src/OPENSOLARIS.LICENSE. | ||
# If applicable, add the following below this CDDL HEADER, with the | ||
# fields enclosed by brackets "[]" replaced with your own identifying | ||
# information: Portions Copyright [yyyy] [name of copyright owner] | ||
# | ||
# CDDL HEADER END | ||
# | ||
|
||
# | ||
# Copyright (c) 2012 by Delphix. All rights reserved. | ||
# | ||
|
||
. $STF_SUITE/include/libtest.shlib | ||
. $STF_SUITE/tests/functional/cli_root/zpool_create/zpool_create.shlib | ||
|
||
################################################################################ | ||
# | ||
# Specifically disabling a feature, all other features should be enabled. | ||
# | ||
# 1. Loop through all existing features: | ||
# a. Create a new pool with '-o feature@XXX=disabled'. | ||
# b. Verify that every other features is in the 'enabled' state. | ||
# | ||
################################################################################ | ||
|
||
verify_runnable "global" | ||
|
||
function cleanup | ||
{ | ||
datasetexists $TESTPOOL && log_must $ZPOOL destroy $TESTPOOL | ||
} | ||
|
||
function check_features | ||
{ | ||
feature="${1}" | ||
feature_set=false | ||
other_feature_set=false | ||
|
||
${ZPOOL} get all ${TESTPOOL} | \ | ||
grep feature@ | \ | ||
while read line; do | ||
set -- $(echo "${line}") | ||
|
||
if [[ "${3}" == "enabled" || "${3}" == "active" ]]; then | ||
if [[ "feature@${feature}" == "${2}" ]]; then | ||
feature_set=true | ||
else | ||
other_feature_set=true | ||
fi | ||
fi | ||
done | ||
|
||
if [[ "${feature_set}" == "true" ]]; then | ||
# This is a success | ||
if [[ "${other_feature_set}" == "true" ]]; then | ||
# .. but if _any_ of the other features is enabled, | ||
# it's a failure! | ||
return 0 | ||
else | ||
# All good - feature is enabled, all other disabled. | ||
return 1 | ||
fi | ||
else | ||
# Feature is not set - failure. | ||
return 1 | ||
fi | ||
} | ||
|
||
log_onexit cleanup | ||
|
||
for feature in async_destroy bookmarks embedded_data empty_bpobj enabled_txg \ | ||
extensible_dataset filesystem_limits hole_birth large_blocks \ | ||
lz4_compress spacemap_histogram large_dnode userobj_accounting \ | ||
sha512 skein edonr | ||
do | ||
log_assert "'zpool create' creates pools with ${feature} disabled" | ||
|
||
log_must $ZPOOL create -f -o "feature@${feature}=disabled" $TESTPOOL $DISKS | ||
check_features ${feature} | ||
log_must $ZPOOL destroy -f $TESTPOOL | ||
|
||
log_pass "'zpool create' creates pools with ${feature} disabled" | ||
done |
[cstyle] 4 space indent for continued lines. Like this: