From ff18617f0bcb2f245d21ff3aec028405f40a5a4c Mon Sep 17 00:00:00 2001 From: Brian M Date: Wed, 13 Nov 2024 16:47:50 -0800 Subject: [PATCH 1/5] Add output from jbof.query --- ixdiagnose/plugins/hardware.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ixdiagnose/plugins/hardware.py b/ixdiagnose/plugins/hardware.py index 6cfa5f0..3d30478 100644 --- a/ixdiagnose/plugins/hardware.py +++ b/ixdiagnose/plugins/hardware.py @@ -3,6 +3,7 @@ import typing from ixdiagnose.utils.command import Command +from ixdiagnose.utils.formatter import remove_keys from ixdiagnose.utils.middleware import MiddlewareClient, MiddlewareCommand from ixdiagnose.utils.run import run @@ -49,6 +50,7 @@ class Hardware(Plugin): MiddlewareClientMetric('enclosures', [MiddlewareCommand('enclosure.query')]), MiddlewareClientMetric('virtualization_variant', [MiddlewareCommand('hardware.virtualization.variant')]), MiddlewareClientMetric('is_virtualized', [MiddlewareCommand('hardware.virtualization.is_virtualized')]), + MiddlewareClientMetric('jbof_config', [MiddlewareCommand('jbof.query', format_output=remove_keys(['mgmt_password']))]), PythonMetric('nvdimm_info', nvdimm_info, serializable=False), ] raw_metrics = [ From 47ca65ec2be0ebcd136b242cc2a346bad7ec7a70 Mon Sep 17 00:00:00 2001 From: Brian M Date: Wed, 13 Nov 2024 16:48:21 -0800 Subject: [PATCH 2/5] Add rdma output --- ixdiagnose/plugins/network.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ixdiagnose/plugins/network.py b/ixdiagnose/plugins/network.py index 7807c65..f74118b 100644 --- a/ixdiagnose/plugins/network.py +++ b/ixdiagnose/plugins/network.py @@ -29,6 +29,15 @@ class Network(Plugin): MiddlewareCommand('route.system_routes'), ] ), + MiddlewareClientMetric( + 'rdma_config', [ + MiddlewareCommand('rdma.capable_protocols', result_key='capable_protocols'), + MiddlewareCommand('rdma.get_card_choices', result_key='card_choices'), + MiddlewareCommand('rdma.get_card_choices', [True], result_key='all_card_choices'), + MiddlewareCommand('rdma.get_link_choices', result_key='link_choices'), + MiddlewareCommand('rdma.interface.query', result_key='interfaces'), + ] + ), ] raw_metrics = [ CommandMetric( From b4aa9a59dd3f90f5001a559dabeb40f539900fef Mon Sep 17 00:00:00 2001 From: Brian M Date: Wed, 13 Nov 2024 17:40:53 -0800 Subject: [PATCH 3/5] flake8 --- ixdiagnose/plugins/hardware.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ixdiagnose/plugins/hardware.py b/ixdiagnose/plugins/hardware.py index 3d30478..b6af6b2 100644 --- a/ixdiagnose/plugins/hardware.py +++ b/ixdiagnose/plugins/hardware.py @@ -50,7 +50,8 @@ class Hardware(Plugin): MiddlewareClientMetric('enclosures', [MiddlewareCommand('enclosure.query')]), MiddlewareClientMetric('virtualization_variant', [MiddlewareCommand('hardware.virtualization.variant')]), MiddlewareClientMetric('is_virtualized', [MiddlewareCommand('hardware.virtualization.is_virtualized')]), - MiddlewareClientMetric('jbof_config', [MiddlewareCommand('jbof.query', format_output=remove_keys(['mgmt_password']))]), + MiddlewareClientMetric('jbof_config', [MiddlewareCommand('jbof.query', + format_output=remove_keys(['mgmt_password']))]), PythonMetric('nvdimm_info', nvdimm_info, serializable=False), ] raw_metrics = [ From 8f15650c94f6ec330e64e2db085f238348ae0590 Mon Sep 17 00:00:00 2001 From: Brian M Date: Thu, 14 Nov 2024 15:35:12 -0800 Subject: [PATCH 4/5] Fix all_link_choices --- ixdiagnose/plugins/network.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ixdiagnose/plugins/network.py b/ixdiagnose/plugins/network.py index f74118b..631c34d 100644 --- a/ixdiagnose/plugins/network.py +++ b/ixdiagnose/plugins/network.py @@ -33,7 +33,7 @@ class Network(Plugin): 'rdma_config', [ MiddlewareCommand('rdma.capable_protocols', result_key='capable_protocols'), MiddlewareCommand('rdma.get_card_choices', result_key='card_choices'), - MiddlewareCommand('rdma.get_card_choices', [True], result_key='all_card_choices'), + MiddlewareCommand('rdma.get_link_choices', [True], result_key='all_link_choices'), MiddlewareCommand('rdma.get_link_choices', result_key='link_choices'), MiddlewareCommand('rdma.interface.query', result_key='interfaces'), ] From 420baa8417d159ad2e81b2fa2ee263ec5ee17009 Mon Sep 17 00:00:00 2001 From: Brian M Date: Fri, 15 Nov 2024 07:55:33 -0800 Subject: [PATCH 5/5] Address review: use PythonMetric for rdma_link_choices --- ixdiagnose/plugins/network.py | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/ixdiagnose/plugins/network.py b/ixdiagnose/plugins/network.py index 631c34d..2f3f9fd 100644 --- a/ixdiagnose/plugins/network.py +++ b/ixdiagnose/plugins/network.py @@ -1,8 +1,20 @@ +from typing import Any + from ixdiagnose.utils.command import Command -from ixdiagnose.utils.middleware import MiddlewareCommand +from ixdiagnose.utils.formatter import dumps +from ixdiagnose.utils.middleware import MiddlewareClient, MiddlewareCommand from .base import Plugin -from .metrics import CommandMetric, FileMetric, MiddlewareClientMetric +from .metrics import CommandMetric, FileMetric, MiddlewareClientMetric, PythonMetric + + +def link_choices(client: MiddlewareClient, context: Any) -> str: + summary = {} + configured_interfaces = client.call('interface.get_configured_interfaces') + for link in client.call('rdma.get_link_choices', True): + summary[link['netdev']] = link | {'configured_interface': link['netdev'] in configured_interfaces} + + return dumps(summary) class Network(Plugin): @@ -33,11 +45,10 @@ class Network(Plugin): 'rdma_config', [ MiddlewareCommand('rdma.capable_protocols', result_key='capable_protocols'), MiddlewareCommand('rdma.get_card_choices', result_key='card_choices'), - MiddlewareCommand('rdma.get_link_choices', [True], result_key='all_link_choices'), - MiddlewareCommand('rdma.get_link_choices', result_key='link_choices'), MiddlewareCommand('rdma.interface.query', result_key='interfaces'), ] ), + PythonMetric('rdma_link_choices', link_choices), ] raw_metrics = [ CommandMetric(