]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
python-common/smb: work around socket path length limits for grpc lib 70684/head
authorJohn Mulligan <jmulligan@redhat.com>
Wed, 29 Jul 2026 19:19:55 +0000 (15:19 -0400)
committerJohn Mulligan <jmulligan@redhat.com>
Wed, 29 Jul 2026 21:53:50 +0000 (17:53 -0400)
The grpc library (at least the version on centos/rocky 10) has a limit
of 107 characters. Even a fairly short host name is going to be close
to this limit due to the UUID and service name in the path.

Because the tool doesn't do much else and it is safe, the workaround is
to chdir to into the parent dir of the socket and only pass the relative
path name of socket.

Fixes: https://tracker.ceph.com/issues/78857
Signed-off-by: John Mulligan <jmulligan@redhat.com>
src/python-common/ceph/smb/ctl/__main__.py

index db2eb0edd9b2509a9c6cf18748dd1832674ba529..94d8f5262bbc269d0ed01c0f800f033347131c08 100644 (file)
@@ -182,7 +182,14 @@ class Context:
                 f' {len(matches)} sockets found',
                 hints=['select clusters using the --cluster option'],
             )
-        return matches[0]
+        socket = matches[0]
+        # workaround for socket length issues in gRPC library. Because the path
+        # will typically include a long(ish) UUID and a possibly long service
+        # name we can changedir to the parent and only pass the file name along
+        # to grpc. This should be safe as this tool doesn't do much file system
+        # ops beyond this point.
+        os.chdir(socket.parent)
+        return socket.relative_to(socket.parent)
 
     def _ceph_keyrings(self, searchdir: pathlib.Path) -> list[pathlib.Path]:
         try: