Merge PR #25058 into master

* refs/pull/25058/head:
	mgr: Fixed devicehealth plugin resource leak

Reviewed-by: Kefu Chai <kchai@redhat.com>
Reviewed-by: Sage Weil <sage@redhat.com>
This commit is contained in:
Sage Weil 2018-11-20 06:50:17 -06:00
commit 9b3d909046

View File

@ -399,7 +399,9 @@ class Module(MgrModule):
# fetch metrics # fetch metrics
res = {} res = {}
ioctx = self.open_connection(create_if_missing=False) 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: with rados.ReadOpCtx() as op:
omap_iter, ret = ioctx.get_omap_vals(op, "", sample or '', 500) # fixme omap_iter, ret = ioctx.get_omap_vals(op, "", sample or '', 500) # fixme
assert ret == 0 assert ret == 0