From 04a4a926fd23b55d2703d99a24fba86066b699df Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Tue, 29 Oct 2019 13:30:15 -0500 Subject: [PATCH] mgr/telemetry: add some rbd metadata Signed-off-by: Sage Weil (cherry picked from commit a42dc0a3d07b813aaa7f44b168e27fe58fbe60e3) --- PendingReleaseNotes | 1 + src/pybind/mgr/telemetry/module.py | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/PendingReleaseNotes b/PendingReleaseNotes index 903add1c8f1f5..13062a1ad2d2a 100644 --- a/PendingReleaseNotes +++ b/PendingReleaseNotes @@ -65,6 +65,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 5de53a3084542..fd22bc6d00b7c 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() @@ -416,6 +418,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']: @@ -445,6 +452,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 -- 2.39.5