Skip to content

Commit

Permalink
optimize pool.dataset.details
Browse files Browse the repository at this point in the history
  • Loading branch information
yocalebo committed Jan 20, 2025
1 parent 972ad20 commit ab7cef1
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 = [
i['name'] for i in query_imported_fast_impl().values() if i['name'] != BOOT_POOL_NAME_VALID
]
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 ab7cef1

Please sign in to comment.