mirror of
https://github.com/ceph/ceph
synced 2024-12-19 09:57:05 +00:00
Merge PR #51891 into main
* refs/pull/51891/head: qa: fix cephfs-top tests for the new fields cephfs-top: include the missing fields in --dump output Reviewed-by: Neeraj Pratap Singh <neesingh@redhat.com>
This commit is contained in:
commit
99adb599e7
@ -66,7 +66,7 @@ class TestFSTop(CephFSTestCase):
|
||||
Tests 'cephfs-top --dump' output is valid
|
||||
"""
|
||||
def verify_fstop_metrics(metrics):
|
||||
clients = metrics.get(self.fs.name, {})
|
||||
clients = metrics.get('filesystems').get(self.fs.name, {})
|
||||
if str(self.mount_a.get_global_id()) in clients and \
|
||||
str(self.mount_b.get_global_id()) in clients:
|
||||
return True
|
||||
|
@ -168,8 +168,8 @@ class FSTopBase(object):
|
||||
return False
|
||||
return True
|
||||
|
||||
def __build_clients(self, fs):
|
||||
fs_meta = self.dump_json.setdefault(fs, {})
|
||||
def __build_clients(self, fs, clients_json):
|
||||
fs_meta = clients_json.setdefault(fs, {})
|
||||
fs_key = self.stats_json[GLOBAL_METRICS_KEY].get(fs, {})
|
||||
clients = fs_key.keys()
|
||||
for client_id in clients:
|
||||
@ -249,13 +249,32 @@ class FSTopBase(object):
|
||||
self.stats_json = self.perf_stats_query()
|
||||
if fs_name: # --dumpfs
|
||||
if fs_name in fs_list:
|
||||
self.__build_clients(fs_name)
|
||||
self.__build_clients(fs_name, clients_json=self.dump_json)
|
||||
else:
|
||||
sys.stdout.write(f"Filesystem {fs_name} not available\n")
|
||||
return
|
||||
else: # --dump
|
||||
num_clients = num_mounts = num_kclients = num_libs = 0
|
||||
for fs_name in fs_list:
|
||||
client_metadata = self.stats_json[CLIENT_METADATA_KEY].get(fs_name, {})
|
||||
client_cnt = len(client_metadata)
|
||||
if client_cnt:
|
||||
num_clients = num_clients + client_cnt
|
||||
num_mounts = num_mounts + len(
|
||||
[client for client, metadata in client_metadata.items() if
|
||||
CLIENT_METADATA_MOUNT_POINT_KEY in metadata
|
||||
and metadata[CLIENT_METADATA_MOUNT_POINT_KEY] != 'N/A'])
|
||||
num_kclients = num_kclients + len(
|
||||
[client for client, metadata in client_metadata.items() if
|
||||
"kernel_version" in metadata])
|
||||
num_libs = num_clients - (num_mounts + num_kclients)
|
||||
self.dump_json.update({'date': datetime.now().ctime()})
|
||||
client_count = self.dump_json.setdefault("client_count", {})
|
||||
client_count.update({'total_clients': num_clients, 'fuse': num_mounts,
|
||||
'kclient': num_kclients, 'libcephfs': num_libs})
|
||||
clients_json = self.dump_json.setdefault("filesystems", {})
|
||||
for fs in fs_list:
|
||||
self.__build_clients(fs)
|
||||
self.__build_clients(fs, clients_json)
|
||||
sys.stdout.write(json.dumps(self.dump_json))
|
||||
sys.stdout.write("\n")
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user