]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
src/pybind: fixing the test_invalid_client_id failure 70375/head
authorNeeraj Pratap Singh <Neeraj.Pratap.Singh1@ibm.com>
Tue, 21 Jul 2026 09:56:49 +0000 (15:26 +0530)
committerNeeraj Pratap Singh <Neeraj.Pratap.Singh1@ibm.com>
Fri, 24 Jul 2026 03:50:06 +0000 (09:20 +0530)
The test_invalid_client_id was failing due to the
incorrect returns by handle_command and in get_perf_data()
in mgr/ststs/fs/perf_stats.py
Introduced-by: f8f972182cb1499e0b7686012b0a854f5e76918b
Fixes:https://tracker.ceph.com/issues/76162
Signed-off-by: Neeraj Pratap Singh <Neeraj.Pratap.Singh1@ibm.com>
src/pybind/mgr/stats/fs/perf_stats.py
src/pybind/mgr/stats/module.py

index 3c602d2e251ee8296f5972afde46f1f3c6868a49..0ef773722da653b46512d969746a8b7ecc677883 100644 (file)
@@ -639,10 +639,7 @@ class FSPerfStats(object):
         return FilterSpec(mds_ranks, client_id, client_ip)
 
     def get_perf_data(self, cmd):
-        try:
-            filter_spec = self.extract_query_filters(cmd)
-        except ValueError as e:
-            return -errno.EINVAL, "", str(e)
+        filter_spec = self.extract_query_filters(cmd)
 
         counters = {}
         with self.lock:
index 119e370a1a6342c4c23ee16d72ee450f4f6b93bd..dd02c2f8c46e4ba2d4d820832cdacc4619dcad63 100644 (file)
@@ -3,6 +3,7 @@ performance stats for ceph filesystem (for now...)
 """
 
 import json
+import errno
 from typing import List, Dict
 from xml.dom.minidom import parseString
 
@@ -46,7 +47,11 @@ class Module(MgrModule):
         prefix = cmd['prefix']
         # only supported command is `fs perf stats` right now
         if prefix.startswith('fs perf stats'):
-            result = self.fs_perf_stats.get_perf_data(cmd)
+            try:
+                result = self.fs_perf_stats.get_perf_data(cmd)
+            except ValueError as e:
+                return -errno.EINVAL, "", str(e)
+            
             if 'format' in cmd:
                 if cmd['format'] == 'json-pretty':
                     return 0, json.dumps(result, indent=2), ""
@@ -54,11 +59,11 @@ class Module(MgrModule):
                     if dicttoxml is None:
                         raise ImportError("dicttoxml package required for xml")
                     result = json.loads(json.dumps(result, default=str))
-                    return dicttoxml(result)
+                    return 0, dicttoxml(result).decode('utf-8'), ""
                 elif cmd['format'] == 'xml-pretty':
                     if dicttoxml is None:
                         raise ImportError("dicttoxml package required for xml")
                     res_xml = parseString(dicttoxml(result))
-                    return res_xml.toprettyxml()
+                    return 0, res_xml.toprettyxml(), ""
             return 0, json.dumps(result), ""
         raise NotImplementedError(cmd['prefix'])