]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/crash: add 'crash ls-new'
authorSage Weil <sage@redhat.com>
Sun, 14 Jul 2019 16:26:41 +0000 (11:26 -0500)
committerSage Weil <sage@redhat.com>
Fri, 15 Nov 2019 14:33:44 +0000 (08:33 -0600)
Signed-off-by: Sage Weil <sage@redhat.com>
(cherry picked from commit bebb1c31006ff3cba67831879b34699cf111f945)

doc/mgr/crash.rst
src/pybind/mgr/crash/module.py

index 8a988103022eaf7d1e2af376a5054c6348981ce6..8cfd130f2aa1e59e65763957be633b79da8d316c 100644 (file)
@@ -37,7 +37,13 @@ Remove a specific crash dump.
 
   ceph crash ls
 
-List the timestamp/uuid crashids for all saved crash info.
+List the timestamp/uuid crashids for all new and archived crash info.
+
+::
+
+  ceph crash ls-new
+
+List the timestamp/uuid crashids for all newcrash info.
 
 ::
 
index a51bd163e652479d56b47fa805053e89e83638a9..4944bdd06432be4b2d5b7f9b0a7deb0ecb8c439d 100644 (file)
@@ -103,6 +103,7 @@ class Module(MgrModule):
             self.crashes[crashid] = metadata
             key = 'crash/%s' % crashid
             self.set_store(key, json.dumps(metadata))
+            self._refresh_health_checks()
         return 0, '', ''
 
     def ls(self):
@@ -111,7 +112,11 @@ class Module(MgrModule):
         return self.do_ls({'prefix': 'crash ls'}, '')
 
     def do_ls(self, cmd, inbuf):
-        r = self.crashes.values()
+        if cmd['prefix'] == 'crash ls':
+            r = self.crashes.values()
+        else:
+            r = [crash for crashid, crash in self.crashes.items()
+                 if 'archived' not in crash]
         if cmd.get('format') == 'json' or cmd.get('format') == 'json-pretty':
             return 0, json.dumps(r, indent=4), ''
         else:
@@ -253,7 +258,13 @@ class Module(MgrModule):
         },
         {
             'cmd': 'crash ls',
-            'desc': 'Show saved crash dumps',
+            'desc': 'Show new and archived crash dumps',
+            'perm': 'r',
+            'handler': do_ls,
+        },
+        {
+            'cmd': 'crash ls-new',
+            'desc': 'Show new crash dumps',
             'perm': 'r',
             'handler': do_ls,
         },