summaryrefslogtreecommitdiffstats
path: root/src/test/admin_socket
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 18:24:20 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 18:24:20 +0000
commit483eb2f56657e8e7f419ab1a4fab8dce9ade8609 (patch)
treee5d88d25d870d5dedacb6bbdbe2a966086a0a5cf /src/test/admin_socket
parentInitial commit. (diff)
downloadceph-483eb2f56657e8e7f419ab1a4fab8dce9ade8609.tar.xz
ceph-483eb2f56657e8e7f419ab1a4fab8dce9ade8609.zip
Adding upstream version 14.2.21.upstream/14.2.21upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/test/admin_socket')
-rwxr-xr-xsrc/test/admin_socket/objecter_requests60
-rw-r--r--src/test/admin_socket/osd_requests28
2 files changed, 88 insertions, 0 deletions
diff --git a/src/test/admin_socket/objecter_requests b/src/test/admin_socket/objecter_requests
new file mode 100755
index 00000000..c2655cdb
--- /dev/null
+++ b/src/test/admin_socket/objecter_requests
@@ -0,0 +1,60 @@
+#!/usr/bin/env python
+
+import json
+import sys
+
+
+def main():
+ """
+ Read json output of admin socket command 'objecter_requests' from
+ stdin, and check it for internal consistency and presence of
+ fields.
+ """
+ read = sys.stdin.read()
+ reqs = json.loads(read)
+
+ op_types = ['linger_ops', 'ops', 'pool_ops', 'pool_stat_ops', 'statfs_ops', 'command_ops']
+ assert sorted(reqs.keys()) == sorted(op_types)
+
+ found_error = check_osd_ops(reqs['ops'] + reqs['linger_ops'])
+ assert not found_error, "ERRORS FOUND!"
+
+
+def check_osd_ops(ops):
+ pg_map = {}
+ locators = {}
+ osds = {}
+ found_error = [False]
+
+ def add_to_mapping(mapping, key, value, msg):
+ if key in mapping:
+ if mapping[key] != value:
+ print('%s != %s' % (mapping[key], value))
+ print(msg)
+ found_error[0] = True
+ else:
+ mapping[key] = value
+
+ for op in ops:
+ add_to_mapping(
+ mapping=pg_map,
+ key=(op['object_id'], op['object_locator']),
+ value=op['pg'],
+ msg='ERROR: two ops for the same object mapped to different pgs',
+ )
+ add_to_mapping(
+ mapping=locators,
+ key=op['object_id'],
+ value=op['object_locator'],
+ msg='ERROR: requests to the same object had different locators',
+ )
+ add_to_mapping(
+ mapping=osds,
+ key=op['pg'],
+ value=op['osd'],
+ msg='ERROR: two ops mapped a pg to different osds',
+ )
+ return found_error[0]
+
+if __name__ == '__main__':
+ main()
diff --git a/src/test/admin_socket/osd_requests b/src/test/admin_socket/osd_requests
new file mode 100644
index 00000000..f748d9dc
--- /dev/null
+++ b/src/test/admin_socket/osd_requests
@@ -0,0 +1,28 @@
+#!/usr/bin/env python
+
+import json
+import sys
+
+def main():
+ """
+ Read json output of admin socket command 'dump_ops_in_flight' from
+ stdin, and check that it is consistent.
+ """
+ read = sys.stdin.read()
+ records = json.loads(read)
+
+ info_types = ['num_ops', 'ops']
+ assert sorted(records.keys()) == sorted(info_types)
+ assert(records['num_ops'] == len(records['ops']))
+
+ for op in records['ops']:
+ assert op['description'] is not None
+ assert op['received_at'] is not None
+ assert op['age'] is not None
+ assert op['flag_point'] is not None
+ if op['client_info']:
+ assert op['client_info']['client'] is not None
+ assert op['client_info']['tid'] is not None
+
+if __name__ == '__main__':
+ main()