From: hsiang41 Date: Mon, 12 Nov 2018 14:43:49 +0000 (+0800) Subject: mgr: Fixed devicehealth plugin resource leak X-Git-Tag: v14.1.0~867^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F25058%2Fhead;p=ceph.git mgr: Fixed devicehealth plugin resource leak The devicehealth plugin not close rados connection at show device metrics function. Signed-off-by: Rick Chen --- diff --git a/src/pybind/mgr/devicehealth/module.py b/src/pybind/mgr/devicehealth/module.py index f2dd5368e3a9..aa684225c70f 100644 --- a/src/pybind/mgr/devicehealth/module.py +++ b/src/pybind/mgr/devicehealth/module.py @@ -400,7 +400,9 @@ class Module(MgrModule): # fetch metrics res = {} ioctx = self.open_connection(create_if_missing=False) - if ioctx: + if not ioctx: + return 0, json.dumps(res, indent=4), '' + with ioctx: with rados.ReadOpCtx() as op: omap_iter, ret = ioctx.get_omap_vals(op, "", sample or '', 500) # fixme assert ret == 0