]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/telemetry: accept channel list to 'telemetry show'
authorSage Weil <sage@redhat.com>
Tue, 9 Jul 2019 19:25:23 +0000 (14:25 -0500)
committerJoao Eduardo Luis <joao@suse.com>
Mon, 9 Dec 2019 19:36:54 +0000 (19:36 +0000)
Also include a 'channels_available' item so that a user can tell which
channels are available.

Signed-off-by: Sage Weil <sage@redhat.com>
(cherry picked from commit e9fdb219c1b946dc2b346b11c5e5d4b04786345d)

Conflicts:
src/pybind/mgr/telemetry/module.py
          Due to lack of 'crash' and 'devicehealth' modules

src/pybind/mgr/telemetry/module.py

index 69b300cf570979db7b5afb9adc03c37dc9f372c9..35cf6a603fae917705f081220ff59b4dccb8f68c 100644 (file)
@@ -16,6 +16,7 @@ from collections import defaultdict
 
 from mgr_module import MgrModule
 
+ALL_CHANNELS = ['basic']
 
 class Module(MgrModule):
     config = dict()
@@ -90,7 +91,8 @@ class Module(MgrModule):
             "perm": "rw"
         },
         {
-            "cmd": "telemetry show",
+            "cmd": "telemetry show "
+                   "name=channels,type=CephString,n=N,req=False",
             "desc": "Show last report or report to be sent",
             "perm": "r"
         },
@@ -227,13 +229,16 @@ class Module(MgrModule):
             r.append('basic')
         return r
 
-    def compile_report(self):
+    def compile_report(self, channels=[]):
+        if not channels:
+            channels = self.get_active_channels()
         report = {
             'leaderboard': False,
             'report_version': 1,
             'report_timestamp': datetime.utcnow().isoformat(),
             'report_id': self.report_id,
-            'channels': self.get_active_channels(),
+            'channels': channels,
+            'channels_available': ALL_CHANNELS,
         }
 
         if self.str_to_bool(self.config['leaderboard']):
@@ -242,7 +247,7 @@ class Module(MgrModule):
         for option in ['description', 'contact', 'organization']:
             report[option] = self.config.get(option, None)
 
-        if self.config['channel_basic']:
+        if 'basic' in channels:
             mon_map = self.get('mon_map')
             osd_map = self.get('osd_map')
             service_map = self.get('service_map')
@@ -346,7 +351,9 @@ class Module(MgrModule):
                 resp.text
             )
         elif command['prefix'] == 'telemetry show':
-            report = self.compile_report()
+            report = self.compile_report(
+                channels=command.get('channels', None)
+            )
             return 0, json.dumps(report, indent=4), ''
         elif command['prefix'] == 'telemetry self-test':
             self.self_test()