我正在尝试在安装了 EFS 文件系统的 AWS 中运行的 Ubuntu 18.04 上使用 nfsiostat。
我尝试的所有操作都会返回此错误消息:
Traceback (most recent call last):
File "/usr/sbin/nfsiostat", line 640, in
iostat_command(prog)
File "/usr/sbin/nfsiostat", line 593, in iostat_command
devices = list_nfs_mounts(origdevices, mountstats)
File "/usr/sbin/nfsiostat", line 495, in list_nfs_mounts
for device, descr in list(mountstats.items()):
TypeError: 'list' object is not callable
答案1
我发现该list_nfs_mounts
函数导致了问题。局部变量list
覆盖了同名的内置函数。
我将该功能更新如下,现在看来它可以正常工作:
def list_nfs_mounts(givenlist, mountstats):
"""return a list of NFS mounts given a list to validate or
return a full list if the given list is empty -
may return an empty list if none found
"""
xlist = []
if len(givenlist) > 0:
for device in givenlist:
stats = DeviceData()
stats.parse_stats(mountstats[device])
if stats.is_nfs_mountpoint():
xlist += [device]
else:
for device, descr in list(mountstats.items()):
stats = DeviceData()
stats.parse_stats(descr)
if stats.is_nfs_mountpoint():
xlist += [device]
return xlist