FreeBSD: Update usage of py-sysctl

py-sysctl now includes the CTLTYPE_NODE type nodes in the list returned
by sysctl.filter() on FreeBSD head.  It also provides descriptions now.

Eliminate the subprocess call to get descriptions, and filter out the
nodes so we only deal with values.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ryan Moeller <ryan@iXsystems.com>
Closes #11318
This commit is contained in:
Ryan Moeller
2020-12-08 17:02:16 +00:00
committed by Brian Behlendorf
parent e5f732edbb
commit 513c196200
3 changed files with 26 additions and 28 deletions
+3 -2
View File
@@ -144,13 +144,14 @@ pretty_print = True
if sys.platform.startswith('freebsd'):
# Requires py27-sysctl on FreeBSD
# Requires py-sysctl on FreeBSD
import sysctl
def kstat_update():
global kstat
k = sysctl.filter('kstat.zfs.misc.arcstats')
k = [ctl for ctl in sysctl.filter('kstat.zfs.misc.arcstats')
if ctl.type != sysctl.CTLTYPE_NODE]
if not k:
sys.exit(1)