Skip to content

Commit

Permalink
[LibFix] Fix CephNode.__getstate__ object properties error
Browse files Browse the repository at this point in the history
RCA:
When rerun used to connect to existing cluster `CephNode` object calls
`__getstate__` method which deletes object properties from dict. This
operation fails when some properties are not present.
To fix issue, add steps to check keys before using `del` method.

Signed-off-by: Vaibhav Mahajan <[email protected]>
  • Loading branch information
vamahaja committed Jan 10, 2025
1 parent 063e328 commit 1932272
Showing 1 changed file with 20 additions and 7 deletions.
27 changes: 20 additions & 7 deletions ceph/ceph.py
Original file line number Diff line number Diff line change
Expand Up @@ -1719,13 +1719,26 @@ def reconnect(self):

def __getstate__(self):
d = dict(self.__dict__)
del d["vm_node"]
del d["rssh"]
del d["ssh"]
del d["rssh_transport"]
del d["ssh_transport"]
del d["root_connection"]
del d["connection"]
if d.get("vm_node"):
del d["vm_node"]

if d.get("rssh"):
del d["rssh"]

if d.get("ssh"):
del d["ssh"]

if d.get("rssh_transport"):
del d["rssh_transport"]

if d.get("ssh_transport"):
del d["ssh_transport"]

if d.get("ssh_transport"):
del d["root_connection"]

if d.get("connection"):
del d["connection"]

return d

Expand Down

0 comments on commit 1932272

Please sign in to comment.