-
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.
If the ZFS_COLOR env variable is set, then use ANSI color output in zpool status: - Column headers are bold - Degraded or offline pools/vdevs are yellow - Non-zero error counters and faulted vdevs/pools are red - The 'status:' and 'action:' sections are yellow if they're displaying a warning. Signed-off-by: Tony Hutter <[email protected]>
- Loading branch information
1 parent
94bcf6f
commit be9e1b6
Showing
11 changed files
with
1,079 additions
and
136 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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,37 @@ | ||
# =========================================================================== | ||
# https://www.gnu.org/software/autoconf-archive/ax_require_defined.html | ||
# =========================================================================== | ||
# | ||
# SYNOPSIS | ||
# | ||
# AX_REQUIRE_DEFINED(MACRO) | ||
# | ||
# DESCRIPTION | ||
# | ||
# AX_REQUIRE_DEFINED is a simple helper for making sure other macros have | ||
# been defined and thus are available for use. This avoids random issues | ||
# where a macro isn't expanded. Instead the configure script emits a | ||
# non-fatal: | ||
# | ||
# ./configure: line 1673: AX_CFLAGS_WARN_ALL: command not found | ||
# | ||
# It's like AC_REQUIRE except it doesn't expand the required macro. | ||
# | ||
# Here's an example: | ||
# | ||
# AX_REQUIRE_DEFINED([AX_CHECK_LINK_FLAG]) | ||
# | ||
# LICENSE | ||
# | ||
# Copyright (c) 2014 Mike Frysinger <[email protected]> | ||
# | ||
# Copying and distribution of this file, with or without modification, are | ||
# permitted in any medium without royalty provided the copyright notice | ||
# and this notice are preserved. This file is offered as-is, without any | ||
# warranty. | ||
|
||
#serial 2 | ||
|
||
AC_DEFUN([AX_REQUIRE_DEFINED], [dnl | ||
m4_ifndef([$1], [m4_fatal([macro ]$1[ is not defined; is a m4 file missing?])]) | ||
])dnl AX_REQUIRE_DEFINED |
Large diffs are not rendered by default.
Oops, something went wrong.
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
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 |
---|---|---|
|
@@ -29,4 +29,4 @@ | |
|
||
DISK=${DISKS%% *} | ||
|
||
default_setup $DISK | ||
default_mirror_setup $DISKS |
78 changes: 78 additions & 0 deletions
78
tests/zfs-tests/tests/functional/cli_root/zpool/zpool_colors.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,78 @@ | ||
#!/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 2007 Sun Microsystems, Inc. All rights reserved. | ||
# Use is subject to license terms. | ||
# | ||
|
||
# | ||
# Copyright (c) 2012, 2016 by Delphix. All rights reserved. | ||
# | ||
|
||
. $STF_SUITE/include/libtest.shlib | ||
|
||
# | ||
# DESCRIPTION: | ||
# Verify debugging features of zpool such as ABORT and freeze/unfreeze | ||
# should run successfully. | ||
# | ||
# STRATEGY: | ||
# 1. Create an array containing each zpool options. | ||
# 2. For each element, execute the zpool command. | ||
# 3. Verify it run successfully. | ||
# | ||
|
||
verify_runnable "both" | ||
|
||
function cleanup | ||
{ | ||
zinject -c all | ||
} | ||
|
||
log_onexit cleanup | ||
|
||
log_assert "Test colorized zpool status output" | ||
|
||
DISK2="$(echo $DISKS | cut -d' ' -f2)" | ||
DISK3="$(echo $DISKS | cut -d' ' -f3)" | ||
|
||
log_must dd if=/dev/urandom of=/$TESTDIR/testfile bs=10M count=1 | ||
|
||
log_must zpool export $TESTPOOL | ||
log_must zpool import $TESTPOOL | ||
|
||
log_note "$(ZFS_COLOR=1 zpool status)" | ||
log_must zpool offline -f $TESTPOOL $DISK3 | ||
log_must wait_for_degraded $TESTPOOL | ||
log_must zinject -d $DISK2 -e io -T read -f 20 $TESTPOOL | ||
log_must zinject -d $DISK2 -e io -T write -f 20 $TESTPOOL | ||
|
||
|
||
log_must zpool scrub $TESTPOOL | ||
log_must wait_scrubbed $TESTPOOL | ||
log_must zinject -c all | ||
|
||
out="$(ZFS_COLOR=1 zpool status)" | ||
|
||
|
||
log_pass "zpool status displayed colors" |