]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
pybind/mgr/mirroring: Fix KeyError: 'directory_count' in daemon status 57763/head
authorJos Collin <jcollin@redhat.com>
Mon, 6 May 2024 12:47:29 +0000 (18:17 +0530)
committerJos Collin <jcollin@redhat.com>
Wed, 29 May 2024 11:58:39 +0000 (17:28 +0530)
commit5ea31d7264758db90bf9b2a9a9a7b899c4049a14
tree5c57ff7dd89d7be24802b19da8e04133574f0687
parent3bb45379356e8aa965152e0b8c663715c5df9bda
pybind/mgr/mirroring: Fix KeyError: 'directory_count' in daemon status

The directory_count key is missing in self.mgr.get_daemon_status() output json,
intermittently when there is a delay caused by m_listener.handle_mirroring_enabled() to update the
directory_count, which results in ServiceDaemon::update_status() creates a json with out 'directory_count' key/value.
But the mgr/mirroring -> daemon_status() always expects the 'directory_count' key to be present in the json returned by
self.mgr.get_daemon_status().

This issue occurs intermittently when we enable/disable mirroring and check the 'daemon status' in between.
This patch fixes this issue by setting a default value 0 for 'directory_count' in doemon_status().

Fixes: https://tracker.ceph.com/issues/65795
Signed-off-by: Jos Collin <jcollin@redhat.com>
(cherry picked from commit b78baa23e562742b8bdc5a75f82e3b6fbf55a8a5)
src/pybind/mgr/mirroring/fs/snapshot_mirror.py