From: John Mulligan Date: Thu, 30 May 2024 19:00:57 +0000 (-0400) Subject: mgr/smb: add transactions to handler funcs underlying show command X-Git-Tag: v20.0.0~1489^2~8 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=da7ebd543d714764b48746462a89ec1b548c2c26;p=ceph.git mgr/smb: add transactions to handler funcs underlying show command Add transaction context manager to the handler functions that underlie the smb module's show command. This makes a pretty good difference in the speed of showing the resources. Signed-off-by: John Mulligan --- diff --git a/src/pybind/mgr/smb/handler.py b/src/pybind/mgr/smb/handler.py index 0595138687a3..d6edc30d2059 100644 --- a/src/pybind/mgr/smb/handler.py +++ b/src/pybind/mgr/smb/handler.py @@ -402,13 +402,15 @@ class ClusterConfigHandler: return list(UsersAndGroupsEntry.ids(self.internal_store)) def all_resources(self) -> List[SMBResource]: - return self._search_resources(_Matcher()) + with _store_transaction(self.internal_store): + return self._search_resources(_Matcher()) def matching_resources(self, names: List[str]) -> List[SMBResource]: matcher = _Matcher() for name in names: matcher.parse(name) - return self._search_resources(matcher) + with _store_transaction(self.internal_store): + return self._search_resources(matcher) def _search_resources(self, matcher: _Matcher) -> List[SMBResource]: log.debug("performing search with matcher: %s", matcher)