Skip to content

Commit

Permalink
optimize pool.dataset.details (#15436)
Browse files Browse the repository at this point in the history
  • Loading branch information
yocalebo authored Jan 20, 2025
1 parent 14bbe82 commit a8f5e99
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/middlewared/middlewared/plugins/pool_/dataset_details.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import os
import pathlib

from middlewared.plugins.boot import BOOT_POOL_NAME_VALID
from middlewared.plugins.zfs_.utils import zvol_path_to_name, TNUserProp
from middlewared.service import Service, private
from middlewared.schema import accepts, List, returns
from middlewared.utils.mount import getmntinfo
from middlewared.utils.zfs import query_imported_fast_impl


class PoolDatasetService(Service):
Expand Down Expand Up @@ -203,7 +205,12 @@ def details(self):
'snapshots_count': True,
}
}
datasets = self.middleware.call_sync('pool.dataset.query', [], options)
valid_pools = list()
for i in query_imported_fast_impl().values():
if i['name'] not in BOOT_POOL_NAME_VALID:
valid_pools.append(i['name'])

datasets = self.middleware.call_sync('pool.dataset.query', [['name', 'in', valid_pools]], options)
mnt_info = getmntinfo()
info = self.build_details(mnt_info)
for dataset in datasets:
Expand Down

0 comments on commit a8f5e99

Please sign in to comment.