]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mgr/telemetry: add some rbd metadata
authorSage Weil <sage@redhat.com>
Tue, 29 Oct 2019 18:30:15 +0000 (13:30 -0500)
committerSage Weil <sage@redhat.com>
Tue, 29 Oct 2019 19:46:53 +0000 (14:46 -0500)
Signed-off-by: Sage Weil <sage@redhat.com>
PendingReleaseNotes
src/pybind/mgr/telemetry/module.py

index cff6a29e2278286a689b5bc83706da502b3486b6..ffa123806157c6b74fd85940cddf2d06e5ef630c 100644 (file)
       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::
 
index 319fb9509191b0a149a19c49840386d1fc95dd3d..b529be8b2392e47cf8efd7b370be6d14200426cc 100644 (file)
@@ -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