]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
python-common/.../service_spec: implement ServiceSpec.__getnewargs__ to allow unpickl...
authorSamuel Just <sjust@redhat.com>
Wed, 29 Oct 2025 21:02:46 +0000 (21:02 +0000)
committerPatrick Donnelly <pdonnell@ibm.com>
Fri, 8 May 2026 19:38:37 +0000 (15:38 -0400)
Signed-off-by: Samuel Just <sjust@redhat.com>
(cherry picked from commit d4a1f2b117a7eeb966ba8072f38d291c00e4a5e5)

src/python-common/ceph/deployment/service_spec.py

index 0408024121599707a508353b32fed6a852181c73..d81734fbf507e76bb682aa2d7889085aa93ce3ab 100644 (file)
@@ -866,6 +866,14 @@ class ServiceSpec(object):
         sub_cls: Any = cls._cls(service_type)
         return object.__new__(sub_cls)
 
+    def __getnewargs__(self):
+        """
+        Pickle will pass the return of this function to __new__ upon
+        unpickle.  We need to ensure it gets service_type in order
+        to get the right subtype.
+        """
+        return (self.service_type,)
+
     def __init__(self,
                  service_type: str,
                  service_id: Optional[str] = None,