From 0763e9be30e81dcc0710abf2ec4941b855dd6e3c Mon Sep 17 00:00:00 2001 From: John Spray Date: Mon, 2 Jul 2018 14:23:10 +0100 Subject: [PATCH] mgr: improve docs on methods that can return None Signed-off-by: John Spray --- src/pybind/mgr/mgr_module.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/pybind/mgr/mgr_module.py b/src/pybind/mgr/mgr_module.py index 82480385f1b96..c6ac24ce52d95 100644 --- a/src/pybind/mgr/mgr_module.py +++ b/src/pybind/mgr/mgr_module.py @@ -453,10 +453,14 @@ class MgrModule(ceph_module.BaseMgrModule): """ Fetch the daemon metadata for a particular service. + ceph-mgr fetches metadata asynchronously, so are windows of time during + addition/removal of services where the metadata is not available to + modules. ``None`` is returned if no metadata is available. + :param str svc_type: service type (e.g., 'mds', 'osd', 'mon') :param str svc_id: service id. convert OSD integer IDs to strings when calling this - :rtype: dict + :rtype: dict, or None if no metadata found """ return self._ceph_get_metadata(svc_type, svc_id) @@ -464,9 +468,12 @@ class MgrModule(ceph_module.BaseMgrModule): """ Fetch the latest status for a particular service daemon. + This method may return ``None`` if no status information is + available, for example because the daemon hasn't fully started yet. + :param svc_type: string (e.g., 'rgw') :param svc_id: string - :return: dict + :return: dict, or None if the service is not found """ return self._ceph_get_daemon_status(svc_type, svc_id) -- 2.39.5