Add runtime gpu capabilities to ilo inspection

Add gpu related dynamic capabilities in ilo inspection.
It would add following dynamic capabilities:

gpu_<vendor>_count : Integer
gpu_<gpu_device_name>_count : Integer
gpu_<gpu_device_name> : boolean

story: 2008702
task: 42023

Change-Id: Ic785fbe8a40d8a999e7e319a6505b46f82ba8344
This commit is contained in:
Nisha Agarwal 2021-03-17 13:07:40 +00:00
parent 00aea13949
commit 9220f97ed7
5 changed files with 42 additions and 1 deletions

View File

@ -941,6 +941,21 @@ Inspection can also discover the following extra capabilities for iLO driver:
This is disable/enable login to the iLO using credentials. This can be toggled only This is disable/enable login to the iLO using credentials. This can be toggled only
by physical visit to the bare metal. by physical visit to the bare metal.
* ``gpu_<vendor>_count``: Integer value. The capability name is dynamically formed as
gpu_<vendor>_count. The vendor name is replaced in the "<vendor>". If the vendor name
is not returned by the hardware, then vendor ID in hexadecimal form is replaced
in the capability name. Examples: {'gpu_Nvidia_count': 1}, {'gpu_0x102b_count': 1}.
* ``gpu_<vendor_device_name>_count``: Integer value. The capability name is formed
dynamically by replacing the gpu device name as returned by ilo in
"<vendor_device_name>". Examples: {'gpu_Nvidia_Tesla_M10_count': 1},
{'gpu_Embedded_Video_Controller_count': 1}
* ``gpu_<vendor_device_name>``: Boolean. The capability name is formed
dynamically by replacing the gpu device name as returned by ilo in
"<vendor_device_name>". Examples: {'gpu_Nvidia_Tesla_M10': True},
{'gpu_Embedded_Video_Controller': True}
.. note:: .. note::
* The capability ``nic_capacity`` can only be discovered if ipmitool * The capability ``nic_capacity`` can only be discovered if ipmitool

View File

@ -4,7 +4,7 @@
# python projects they should package as optional dependencies for Ironic. # python projects they should package as optional dependencies for Ironic.
# These are available on pypi # These are available on pypi
proliantutils>=2.10.0 proliantutils>=2.11.0
pysnmp>=4.3.0,<5.0.0 pysnmp>=4.3.0,<5.0.0
python-scciclient>=0.8.0 python-scciclient>=0.8.0
python-dracclient>=5.1.0,<6.0.0 python-dracclient>=5.1.0,<6.0.0

View File

@ -123,6 +123,13 @@ def _create_supported_capabilities_dict(capabilities):
""" """
valid_cap = {} valid_cap = {}
# Add the capabilities starting with "gpu_" to the supported capabilities
# keys set as they are runtime generated keys and cannot be hardcoded.
for k in capabilities:
if k.startswith("gpu_"):
valid_cap[k] = capabilities.get(k)
for key in CAPABILITIES_KEYS.intersection(capabilities): for key in CAPABILITIES_KEYS.intersection(capabilities):
valid_cap[key] = capabilities.get(key) valid_cap[key] = capabilities.get(key)
return valid_cap return valid_cap

View File

@ -466,3 +466,15 @@ class TestInspectPrivateMethods(test_common.BaseIloTest):
expected.update({key: 'true'}) expected.update({key: 'true'})
cap = ilo_inspect._create_supported_capabilities_dict(capabilities) cap = ilo_inspect._create_supported_capabilities_dict(capabilities)
self.assertEqual(expected, cap) self.assertEqual(expected, cap)
def test___create_supported_capabilities_dict_gpu_capabilities(self):
capabilities = {'gpu_Nvidia_count': 1, 'gpu_Nvidia_Tesla_M10_count': 1,
'gpu_Nvidia_Tesla_M10': True}
expected = {}
expected.update(capabilities)
for key in ilo_inspect.CAPABILITIES_KEYS:
capabilities.update({key: 'true'})
expected.update({key: 'true'})
capabilities.update({'unknown_property': 'true'})
cap = ilo_inspect._create_supported_capabilities_dict(capabilities)
self.assertEqual(expected, cap)

View File

@ -0,0 +1,7 @@
---
features:
- |
Adds new GPU dynamic capabilities to ``ilo`` drivers inspection.
gpu_<vendor>_count: Integer
gpu_<gpu_device_name>_count: Integer
gpu_<gpu_device_name>: Boolean