Skip to content

Commit

Permalink
Fix zvol collection.
Browse files Browse the repository at this point in the history
  • Loading branch information
mgrimesix committed Jul 26, 2024
1 parent 50f08e4 commit c7f6849
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/freenas/usr/local/bin/snmp-agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -411,10 +411,11 @@ def report_zfs_info(prev_zpool_info):

def get_list_of_zvols():
zvols = set()
root_dir = '/dev/zvol'
with contextlib.suppress(FileNotFoundError): # no zvols
for root_dir, unused_dirs, files in os.walk('/dev/zvol/'):
for dir_path, unused_dirs, files in os.walk(root_dir):
for file in filter(lambda x: '@' not in x, files):
zvols.add(os.path.join(root_dir, file).removeprefix(root_dir).replace('+', ' '))
zvols.add(os.path.join(dir_path, file).removeprefix(root_dir).replace('+', ' '))

return list(zvols)

Expand Down

0 comments on commit c7f6849

Please sign in to comment.