From: Sage Weil Date: Tue, 29 Oct 2019 18:30:15 +0000 (-0500) Subject: mgr/telemetry: add some rbd metadata X-Git-Tag: v15.1.0~1083^2~5 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=a42dc0a3d07b813aaa7f44b168e27fe58fbe60e3;p=ceph.git mgr/telemetry: add some rbd metadata Signed-off-by: Sage Weil --- diff --git a/PendingReleaseNotes b/PendingReleaseNotes index cff6a29e2278..ffa123806157 100644 --- a/PendingReleaseNotes +++ b/PendingReleaseNotes @@ -210,6 +210,7 @@ which erasure code profile plugin and parameters are in use - how many hosts are in the cluster, and how many hosts have each type of daemon - whether a separate OSD cluster network is being used + - how many RBD pools and images are in the cluster, and how many pools have RBD mirroring enabled If you had telemetry enabled, you will need to re-opt-in with:: diff --git a/src/pybind/mgr/telemetry/module.py b/src/pybind/mgr/telemetry/module.py index 319fb9509191..b529be8b2392 100644 --- a/src/pybind/mgr/telemetry/module.py +++ b/src/pybind/mgr/telemetry/module.py @@ -7,6 +7,7 @@ when user has opted-in import errno import hashlib import json +import rbd import re import requests import uuid @@ -53,6 +54,7 @@ REVISION = 3 # - added more pool metadata (rep vs ec, cache tiering mode, ec profile) # - added host count, and counts for hosts with each of (mon, osd, mds, mgr) # - whether an OSD cluster network is in use +# - rbd pool and image count, and rbd mirror mode (pool-level) class Module(MgrModule): config = dict() @@ -403,6 +405,11 @@ class Module(MgrModule): report['config'] = self.gather_configs() # pools + report['rbd'] = { + 'num_pools': 0, + 'num_images_by_pool': [], + 'mirroring_by_pool': [], + } num_pg = 0 report['pools'] = list() for pool in osd_map['pools']: @@ -432,6 +439,13 @@ class Module(MgrModule): 'cache_mode': pool['cache_mode'], } ) + if 'rbd' in pool['application_metadata']: + report['rbd']['num_pools'] += 1 + ioctx = self.rados.open_ioctx(pool['pool_name']) + report['rbd']['num_images_by_pool'].append( + sum(1 for _ in rbd.RBD().list2(ioctx))) + report['rbd']['mirroring_by_pool'].append( + rbd.RBD().mirror_mode_get(ioctx) != rbd.RBD_MIRROR_MODE_DISABLED) # osds cluster_network = False