]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr: Fixed devicehealth plugin resource leak 25058/head
authorhsiang41 <rick.chen@prophetstor.com>
Mon, 12 Nov 2018 14:43:49 +0000 (22:43 +0800)
committerhsiang41 <rick.chen@prophetstor.com>
Fri, 16 Nov 2018 01:44:58 +0000 (09:44 +0800)
The devicehealth plugin not close rados connection at show device metrics
 function.

Signed-off-by: Rick Chen <rick.chen@prophetstor.com>
src/pybind/mgr/devicehealth/module.py

index f2dd5368e3a937c06afb0266c17bf3668f99cd6c..aa684225c70f0c20805d3b4daa038436c56dcaed 100644 (file)
@@ -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