mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-25 03:37:45 +03:00
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:
committed by
Brian Behlendorf
parent
f217a2b902
commit
20e4513c56
@@ -59,14 +59,20 @@ if sys.platform.startswith('freebsd'):
|
||||
# Requires py27-sysctl on FreeBSD
|
||||
import sysctl
|
||||
|
||||
def is_value(ctl):
|
||||
return ctl.type != sysctl.CTLTYPE_NODE
|
||||
|
||||
def load_kstats(namespace):
|
||||
"""Collect information on a specific subsystem of the ARC"""
|
||||
|
||||
base = 'kstat.zfs.misc.%s.' % namespace
|
||||
return [(kstat.name, D(kstat.value)) for kstat in sysctl.filter(base)]
|
||||
fmt = lambda kstat: (kstat.name, D(kstat.value))
|
||||
kstats = sysctl.filter(base)
|
||||
return [fmt(kstat) for kstat in kstats if is_value(kstat)]
|
||||
|
||||
def load_tunables():
|
||||
return dict((ctl.name, ctl.value) for ctl in sysctl.filter('vfs.zfs'))
|
||||
ctls = sysctl.filter('vfs.zfs')
|
||||
return dict((ctl.name, ctl.value) for ctl in ctls if is_value(ctl))
|
||||
|
||||
elif sys.platform.startswith('linux'):
|
||||
|
||||
|
||||
Reference in New Issue
Block a user