summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZuul <zuul@review.opendev.org>2021-03-19 08:32:15 +0000
committerGerrit Code Review <review@openstack.org>2021-03-19 08:32:15 +0000
commita06e403b11cc2337b03a02f480eba6362825aa71 (patch)
tree1949735a7e26ce4e0abb0e78602a9216a1c0980d
parente5b391c32df22ecfe8162b3a48b03748a375f0c3 (diff)
parent9220f97ed71e9401ce259a9bc1153ff589edd9f1 (diff)
downloadironic-a06e403b11cc2337b03a02f480eba6362825aa71.tar.gz
Merge "Add runtime gpu capabilities to ilo inspection"
-rw-r--r--doc/source/admin/drivers/ilo.rst15
-rw-r--r--driver-requirements.txt2
-rw-r--r--ironic/drivers/modules/ilo/inspect.py7
-rw-r--r--ironic/tests/unit/drivers/modules/ilo/test_inspect.py12
-rw-r--r--releasenotes/notes/gpu_dynamic_capabilities-b56b90549882b6c2.yaml7
5 files changed, 42 insertions, 1 deletions
diff --git a/doc/source/admin/drivers/ilo.rst b/doc/source/admin/drivers/ilo.rst
index 24ac8c2c4..17d356d0e 100644
--- a/doc/source/admin/drivers/ilo.rst
+++ b/doc/source/admin/drivers/ilo.rst
@@ -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
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::
* The capability ``nic_capacity`` can only be discovered if ipmitool
diff --git a/driver-requirements.txt b/driver-requirements.txt
index 7673c281c..1bd25844a 100644
--- a/driver-requirements.txt
+++ b/driver-requirements.txt
@@ -4,7 +4,7 @@
# python projects they should package as optional dependencies for Ironic.
# These are available on pypi
-proliantutils>=2.10.0
+proliantutils>=2.11.0
pysnmp>=4.3.0,<5.0.0
python-scciclient>=0.8.0
python-dracclient>=5.1.0,<6.0.0
diff --git a/ironic/drivers/modules/ilo/inspect.py b/ironic/drivers/modules/ilo/inspect.py
index 625cf8e12..1e41a1226 100644
--- a/ironic/drivers/modules/ilo/inspect.py
+++ b/ironic/drivers/modules/ilo/inspect.py
@@ -123,6 +123,13 @@ def _create_supported_capabilities_dict(capabilities):
"""
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):
valid_cap[key] = capabilities.get(key)
return valid_cap
diff --git a/ironic/tests/unit/drivers/modules/ilo/test_inspect.py b/ironic/tests/unit/drivers/modules/ilo/test_inspect.py
index a10c34bd9..ce81a2e47 100644
--- a/ironic/tests/unit/drivers/modules/ilo/test_inspect.py
+++ b/ironic/tests/unit/drivers/modules/ilo/test_inspect.py
@@ -466,3 +466,15 @@ class TestInspectPrivateMethods(test_common.BaseIloTest):
expected.update({key: 'true'})
cap = ilo_inspect._create_supported_capabilities_dict(capabilities)
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)
diff --git a/releasenotes/notes/gpu_dynamic_capabilities-b56b90549882b6c2.yaml b/releasenotes/notes/gpu_dynamic_capabilities-b56b90549882b6c2.yaml
new file mode 100644
index 000000000..4bf8ec54d
--- /dev/null
+++ b/releasenotes/notes/gpu_dynamic_capabilities-b56b90549882b6c2.yaml
@@ -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