Add Python 3 rewrite of arc_summary.py

Add new script arc_summary3.py as a complete rewrite of the
arc_summary.py tool (see issue #6873)

Add new options:

        -g/--graph    - Display crude graphic representation
                        of ARC status and quit
        -r/--raw      - Print all available information as
                        minimally formatted list (for grep)
        -s/--section  - Print a single section. This
                        replaces -p/--page, which is kept for
                        backwards use but marked as
                        depreciated

Add new sections with information on ZIL and SPL. Notify user
if sections L2ARC and VDEV are skipped instead of failing
silently. Add warning that -p/--page option is depreciated.

Developed for Python 3.5.

Reviewed-by: Richard Laager <rlaager@wiktel.com>
Reviewed-by: Richard Elling <Richard.Elling@RichardElling.com>
Reviewed by: George Melikov <mail@gmelikov.ru>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Scot W. Stevenson <scot.stevenson@gmail.com>
Closes #6873 
Closes #6892
This commit is contained in:
Scot W. Stevenson
2018-02-28 17:52:34 +01:00
committed by Brian Behlendorf
parent 3e9c9d8a89
commit 19528cf949
6 changed files with 918 additions and 2 deletions
+2 -1
View File
@@ -436,7 +436,8 @@ tests = ['zdb_001_neg', 'zfs_001_neg', 'zfs_allow_001_neg',
'zpool_offline_001_neg', 'zpool_online_001_neg', 'zpool_remove_001_neg',
'zpool_replace_001_neg', 'zpool_scrub_001_neg', 'zpool_set_001_neg',
'zpool_status_001_neg', 'zpool_upgrade_001_neg', 'arcstat_001_pos',
'arc_summary_001_pos', 'arc_summary_002_neg', 'dbufstat_001_pos']
'arc_summary_001_pos', 'arc_summary_002_neg',
'arc_summary3_001_pos', 'dbufstat_001_pos']
user =
tags = ['functional', 'cli_user', 'misc']
+2
View File
@@ -91,6 +91,7 @@ export SYSTEM_FILES='arp
ps
pwd
python
python3
quotaon
readlink
rm
@@ -143,6 +144,7 @@ export ZFS_FILES='zdb
ztest
raidz_test
arc_summary.py
arc_summary3.py
arcstat.py
dbufstat.py
zed
@@ -47,4 +47,5 @@ dist_pkgdata_SCRIPTS = \
arcstat_001_pos.ksh \
arc_summary_001_pos.ksh \
arc_summary_002_neg.ksh \
arc_summary3_001_pos.ksh \
dbufstat_001_pos.ksh
@@ -0,0 +1,56 @@
#! /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) 2015 by Lawrence Livermore National Security, LLC.
# All rights reserved.
#
. $STF_SUITE/include/libtest.shlib
# Keep the following test until Python 3 is installed on all test systems,
# then remove
python3 -V 2>&1 > /dev/null
if (( $? )); then
log_unsupported "Python3 is not installed"
fi
# Some systems have Python 3 installed, but only older versions that don't
# have the subprocess.run() functionality. We catch these with a separate
# test. Remove this when all systems have reached 3.5 or greater
VERSIONPYTEST=$(python3 -V)
if [[ ${VERSIONPYTEST:9:1} -lt 5 ]]; then
log_unsupported "Python3 must be version 3.5 or greater"
fi
set -A args "" "-a" "-d" "-p 1" "-g" "-s arc" "-r"
log_assert "arc_summary3.py generates output and doesn't return an error code"
typeset -i i=0
while [[ $i -lt ${#args[*]} ]]; do
log_must eval "arc_summary3.py ${args[i]} > /dev/null"
((i = i + 1))
done
log_pass "arc_summary3.py generates output and doesn't return an error code"