]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/smb: add transactions to handler funcs underlying show command
authorJohn Mulligan <jmulligan@redhat.com>
Thu, 30 May 2024 19:00:57 +0000 (15:00 -0400)
committerJohn Mulligan <jmulligan@redhat.com>
Sat, 6 Jul 2024 18:53:06 +0000 (14:53 -0400)
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 <jmulligan@redhat.com>
src/pybind/mgr/smb/handler.py

index 0595138687a30e302ec961e5230dd53d3baed80b..d6edc30d20595c350e861c9891b99a4f1858c05e 100644 (file)
@@ -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)