zfsonlinux/zfs-patches/0017-Minor-code-cleanups-in-arc_python.py.patch
Fabian Grünbichler 6beaed3f99 add remaining zfs-0.7.6 changes as patches
since Debian unstable has not been updated yet.
2018-02-21 09:52:27 +01:00

79 lines
2.5 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: "Scot W. Stevenson" <scot.stevenson@gmail.com>
Date: Wed, 15 Nov 2017 19:28:11 +0100
Subject: [PATCH] Minor code cleanups in arc_python.py
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Remove unused library re and associated variable kstat_pobj. Add note
to documentation at start of program about required support for old
versions of Python. Change variable "format" (which is a built-in
function) to "fmt".
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 #6869
(cherry picked from commit d486dee89e54560536a759f3c5fb1eb8b07efc3f)
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
---
cmd/arc_summary/arc_summary.py | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/cmd/arc_summary/arc_summary.py b/cmd/arc_summary/arc_summary.py
index ec0468ecc..c9a2c5d03 100755
--- a/cmd/arc_summary/arc_summary.py
+++ b/cmd/arc_summary/arc_summary.py
@@ -31,6 +31,10 @@
#
# If you are having troubles when using this script from cron(8) please try
# adjusting your PATH before reporting problems.
+#
+# Note some of this code uses older code (eg getopt instead of argparse,
+# subprocess.Popen() instead of subprocess.run()) because we need to support
+# some very old versions of Python.
"""Print statistics on the ZFS Adjustable Replacement Cache (ARC)
Provides basic information on the ARC, its efficiency, the L2ARC (if present),
@@ -41,7 +45,6 @@ https://github.com/zfsonlinux/zfs/blob/master/module/zfs/arc.c for details.
import getopt
import os
-import re
import sys
import time
@@ -50,7 +53,6 @@ from decimal import Decimal as D
show_tunable_descriptions = False
alternate_tunable_layout = False
-kstat_pobj = re.compile("^([^:]+):\s+(.+)\s*$", flags=re.M)
def get_Kstat():
@@ -911,9 +913,9 @@ def _tunable_summary(Kstat):
names.sort()
if alternate_tunable_layout:
- format = "\t%s=%s\n"
+ fmt = "\t%s=%s\n"
else:
- format = "\t%-50s%s\n"
+ fmt = "\t%-50s%s\n"
for name in names:
@@ -923,7 +925,7 @@ def _tunable_summary(Kstat):
if show_tunable_descriptions and name in descriptions:
sys.stdout.write("\t# %s\n" % descriptions[name])
- sys.stdout.write(format % (name, values[name]))
+ sys.stdout.write(fmt % (name, values[name]))
unSub = [
--
2.14.2