From 52fdbb743d5d84ab3309822ae758c1f76a26f186 Mon Sep 17 00:00:00 2001 From: Doug Goldstein Date: Tue, 13 Aug 2024 12:01:13 -0500 Subject: [PATCH] idrac: inherit driver interface from redfish With the removal of the wsman interfaces in the idrac driver and only redfish being supported, the idrac driver should inherit from the redfish driver to ensure that it properly supports all the redfish supported interfaces. Furthermore with several of the interfaces being no-op passthru to the redfish implementation there is no reason to not let the user select those interfaces as well. With an eye towards not having to support these in the future, direct users to use the stock redfish versions in the docs as well. Change-Id: I79ab44f31660e6d5311db46223e8bd60d2b3f213 Signed-off-by: Doug Goldstein --- doc/source/admin/drivers/idrac.rst | 20 +++++---- ironic/drivers/drac.py | 45 +++++++++++-------- ironic/drivers/modules/drac/bios.py | 2 + ironic/drivers/modules/drac/power.py | 3 +- .../drivers/modules/drac/vendor_passthru.py | 2 + ironic/tests/unit/drivers/test_drac.py | 44 +++++++++++------- ...drac-extends-redfish-6692c2ecdb07dc2e.yaml | 15 +++++++ 7 files changed, 85 insertions(+), 46 deletions(-) create mode 100644 releasenotes/notes/idrac-extends-redfish-6692c2ecdb07dc2e.yaml diff --git a/doc/source/admin/drivers/idrac.rst b/doc/source/admin/drivers/idrac.rst index 03277d29fd..a1cb300727 100644 --- a/doc/source/admin/drivers/idrac.rst +++ b/doc/source/admin/drivers/idrac.rst @@ -26,7 +26,8 @@ Key features of the Dell iDRAC driver include: Ironic Features --------------- -The ``idrac`` hardware type supports the following Ironic interfaces: +The ``idrac`` hardware type extends the ``redfish`` hardware type +and supports the following Ironic interfaces: * `BIOS Interface`_: BIOS management * `Inspect Interface`_: Hardware inspection @@ -61,7 +62,7 @@ To enable the ``idrac`` hardware type, add the following to your [DEFAULT] enabled_hardware_types=idrac enabled_management_interfaces=idrac-redfish - enabled_power_interfaces=idrac-redfish + enabled_power_interfaces=redfish To enable all optional features (BIOS, inspection, RAID, and vendor passthru), use the following configuration: @@ -70,7 +71,7 @@ use the following configuration: [DEFAULT] enabled_hardware_types=idrac - enabled_bios_interfaces=idrac-redfish + enabled_bios_interfaces=redfish enabled_firmware_interfaces=redfish enabled_inspect_interfaces=idrac-redfish enabled_management_interfaces=idrac-redfish @@ -85,7 +86,8 @@ order: Interface Supported Implementations ================ =================================================== ``bios`` ``idrac-redfish``, ``no-bios`` -``boot`` ``ipxe``, ``pxe``, ``idrac-redfish-virtual-media`` +``boot`` ``ipxe``, ``pxe``, ``http-ipxe``, ``http``, + ``redfish-https``, ``idrac-redfish-virtual-media`` ``console`` ``no-console`` ``deploy`` ``direct``, ``ansible``, ``ramdisk`` ``firmware`` ``redfish``, ``no-firmware`` @@ -93,11 +95,11 @@ Interface Supported Implementations ``inspector``, ``no-inspect`` ``management`` ``idrac-redfish`` ``network`` ``flat``, ``neutron``, ``noop`` -``power`` ``idrac-redfish`` +``power`` ``redfish``, ``idrac-redfish`` ``raid`` ``idrac-redfish``, ``no-raid`` ``rescue`` ``no-rescue``, ``agent`` ``storage`` ``noop``, ``cinder``, ``external`` -``vendor`` ``idrac-redfish``, +``vendor`` ``redfish``, ``idrac-redfish``, ``no-vendor`` ================ =================================================== @@ -135,12 +137,12 @@ hardware type using Redfish for all interfaces: --driver-info redfish_password=pa$$w0rd \ --driver-info redfish_address=drac.host \ --driver-info redfish_system_id=/redfish/v1/Systems/System.Embedded.1 \ - --bios-interface idrac-redfish \ + --bios-interface redfish \ --inspect-interface idrac-redfish \ --management-interface idrac-redfish \ - --power-interface idrac-redfish \ + --power-interface redfish \ --raid-interface idrac-redfish \ - --vendor-interface idrac-redfish + --vendor-interface redfish BIOS Interface ============== diff --git a/ironic/drivers/drac.py b/ironic/drivers/drac.py index 5c8198a9a8..7fa1239c17 100644 --- a/ironic/drivers/drac.py +++ b/ironic/drivers/drac.py @@ -17,7 +17,6 @@ DRAC Driver for remote system management using Dell Remote Access Card. from oslo_config import cfg -from ironic.drivers import generic from ironic.drivers.modules.drac import bios from ironic.drivers.modules.drac import boot from ironic.drivers.modules.drac import inspect as drac_inspect @@ -25,16 +24,16 @@ from ironic.drivers.modules.drac import management from ironic.drivers.modules.drac import power from ironic.drivers.modules.drac import raid from ironic.drivers.modules.drac import vendor_passthru -from ironic.drivers.modules import ipxe -from ironic.drivers.modules import noop -from ironic.drivers.modules import pxe -from ironic.drivers.modules.redfish import firmware as redfish_firmware +from ironic.drivers.modules.redfish import boot as redfish_boot +from ironic.drivers.modules.redfish import inspect as redfish_inspect +from ironic.drivers.modules.redfish import raid as redfish_raid +from ironic.drivers import redfish CONF = cfg.CONF -class IDRACHardware(generic.GenericHardware): +class IDRACHardware(redfish.RedfishHardware): """integrated Dell Remote Access Controller hardware type""" # Required hardware interfaces @@ -42,7 +41,11 @@ class IDRACHardware(generic.GenericHardware): @property def supported_boot_interfaces(self): """List of supported boot interfaces.""" - return [ipxe.iPXEBoot, pxe.PXEBoot, boot.DracRedfishVirtualMediaBoot] + inherited = super().supported_boot_interfaces + # remove the generic redfish one in favor of the Dell specific + idx = inherited.index(redfish_boot.RedfishVirtualMediaBoot) + inherited[idx] = boot.DracRedfishVirtualMediaBoot + return inherited @property def supported_management_interfaces(self): @@ -52,18 +55,16 @@ class IDRACHardware(generic.GenericHardware): @property def supported_power_interfaces(self): """List of supported power interfaces.""" - return [power.DracRedfishPower] + return ([power.DracRedfishPower] + + super().supported_power_interfaces) # Optional hardware interfaces @property def supported_bios_interfaces(self): """List of supported bios interfaces.""" - return [bios.DracRedfishBIOS, noop.NoBIOS] - - @property - def supported_firmware_interfaces(self): - return [redfish_firmware.RedfishFirmware, noop.NoFirmware] + return ([bios.DracRedfishBIOS] + + super().supported_bios_interfaces) @property def supported_inspect_interfaces(self): @@ -71,17 +72,23 @@ class IDRACHardware(generic.GenericHardware): # Inspector support should have a higher priority than NoInspect # if it is enabled by an operator (implying that the service is # installed). - return [drac_inspect.DracRedfishInspect] + super( - IDRACHardware, self).supported_inspect_interfaces + inherited = super().supported_inspect_interfaces + # remove the generic redfish one in favor of the Dell specific + idx = inherited.index(redfish_inspect.RedfishInspect) + inherited[idx] = drac_inspect.DracRedfishInspect + return inherited @property def supported_raid_interfaces(self): """List of supported raid interfaces.""" - return [raid.DracRedfishRAID] + super( - IDRACHardware, self).supported_raid_interfaces + inherited = super().supported_raid_interfaces + # remove the generic redfish one in favor of the Dell specific + idx = inherited.index(redfish_raid.RedfishRAID) + inherited[idx] = raid.DracRedfishRAID + return inherited @property def supported_vendor_interfaces(self): """List of supported vendor interfaces.""" - return [vendor_passthru.DracRedfishVendorPassthru, - noop.NoVendor] + return ([vendor_passthru.DracRedfishVendorPassthru] + + super().supported_vendor_interfaces) diff --git a/ironic/drivers/modules/drac/bios.py b/ironic/drivers/modules/drac/bios.py index 0af607912e..32cde378d0 100644 --- a/ironic/drivers/modules/drac/bios.py +++ b/ironic/drivers/modules/drac/bios.py @@ -26,3 +26,5 @@ class DracRedfishBIOS(redfish_bios.RedfishBIOS): specific incompatibilities and introduction of vendor value added should be implemented by this class. """ + # NOTE(cardoe): deprecated in favor of plain Redfish + supported = False diff --git a/ironic/drivers/modules/drac/power.py b/ironic/drivers/modules/drac/power.py index bd2df80a1a..8b73f16735 100644 --- a/ironic/drivers/modules/drac/power.py +++ b/ironic/drivers/modules/drac/power.py @@ -27,4 +27,5 @@ class DracRedfishPower(redfish_power.RedfishPower): specific incompatibilities and introduction of vendor value added should be implemented by this class. """ - pass + # NOTE(cardoe): deprecated in favor of plain Redfish + supported = False diff --git a/ironic/drivers/modules/drac/vendor_passthru.py b/ironic/drivers/modules/drac/vendor_passthru.py index ca85b7c451..eb570cd273 100644 --- a/ironic/drivers/modules/drac/vendor_passthru.py +++ b/ironic/drivers/modules/drac/vendor_passthru.py @@ -23,3 +23,5 @@ class DracRedfishVendorPassthru(redfish_vendor.RedfishVendorPassthru): Use the Redfish implementation for vendor passthru. """ + # NOTE(cardoe): deprecated in favor of plain Redfish + supported = False diff --git a/ironic/tests/unit/drivers/test_drac.py b/ironic/tests/unit/drivers/test_drac.py index 60e7cccee5..a4751452ea 100644 --- a/ironic/tests/unit/drivers/test_drac.py +++ b/ironic/tests/unit/drivers/test_drac.py @@ -21,6 +21,7 @@ from ironic.drivers.modules import inspector from ironic.drivers.modules import ipxe from ironic.drivers.modules.network import flat as flat_net from ironic.drivers.modules import noop +from ironic.drivers.modules import redfish from ironic.drivers.modules.storage import noop as noop_storage from ironic.tests.unit.db import base as db_base from ironic.tests.unit.objects import utils as obj_utils @@ -35,7 +36,7 @@ class IDRACHardwareTestCase(db_base.DbTestCase): enabled_boot_interfaces=[ 'idrac-redfish-virtual-media', 'ipxe', 'pxe'], enabled_management_interfaces=['idrac-redfish'], - enabled_power_interfaces=['idrac-redfish'], + enabled_power_interfaces=['idrac-redfish', 'redfish'], enabled_inspect_interfaces=[ 'idrac-redfish', 'inspector', 'no-inspect'], @@ -43,8 +44,10 @@ class IDRACHardwareTestCase(db_base.DbTestCase): enabled_raid_interfaces=[ 'idrac-redfish', 'no-raid', 'agent'], - enabled_vendor_interfaces=['idrac-redfish', 'no-vendor'], - enabled_bios_interfaces=['idrac-redfish', 'no-bios']) + enabled_vendor_interfaces=[ + 'idrac-redfish', 'redfish', 'no-vendor'], + enabled_bios_interfaces=[ + 'idrac-redfish', 'redfish', 'no-bios']) def _validate_interfaces(self, driver, **kwargs): self.assertIsInstance( @@ -120,30 +123,37 @@ class IDRACHardwareTestCase(db_base.DbTestCase): self._validate_interfaces(task.driver, raid=drac.raid.DracRedfishRAID) - def test_override_no_vendor(self): - node = obj_utils.create_test_node(self.context, driver='idrac', - vendor_interface='no-vendor') - with task_manager.acquire(self.context, node.id) as task: - self._validate_interfaces(task.driver, - vendor=noop.NoVendor) + def test_override_with_redfish_vendor(self): + for iface, impl in [('redfish', + redfish.vendor.RedfishVendorPassthru), + ('no-vendor', noop.NoVendor)]: + node = obj_utils.create_test_node(self.context, + uuid=uuidutils.generate_uuid(), + driver='idrac', + vendor_interface=iface) + with task_manager.acquire(self.context, node.id) as task: + self._validate_interfaces(task.driver, + vendor=impl) def test_override_with_redfish_management_and_power(self): node = obj_utils.create_test_node(self.context, driver='idrac', management_interface='idrac-redfish', - power_interface='idrac-redfish') + power_interface='redfish') with task_manager.acquire(self.context, node.id) as task: self._validate_interfaces( task.driver, management=drac.management.DracRedfishManagement, - power=drac.power.DracRedfishPower) + power=redfish.power.RedfishPower) def test_override_with_redfish_bios(self): - node = obj_utils.create_test_node(self.context, driver='idrac', - bios_interface='idrac-redfish') - with task_manager.acquire(self.context, node.id) as task: - self._validate_interfaces( - task.driver, - bios=drac.bios.DracRedfishBIOS) + for iface, impl in [('redfish', redfish.bios.RedfishBIOS), + ('no-bios', noop.NoBIOS)]: + node = obj_utils.create_test_node(self.context, + uuid=uuidutils.generate_uuid(), + driver='idrac', + bios_interface=iface) + with task_manager.acquire(self.context, node.id) as task: + self._validate_interfaces(task.driver, bios=impl) def test_override_with_redfish_inspect(self): node = obj_utils.create_test_node(self.context, driver='idrac', diff --git a/releasenotes/notes/idrac-extends-redfish-6692c2ecdb07dc2e.yaml b/releasenotes/notes/idrac-extends-redfish-6692c2ecdb07dc2e.yaml new file mode 100644 index 0000000000..f928c28088 --- /dev/null +++ b/releasenotes/notes/idrac-extends-redfish-6692c2ecdb07dc2e.yaml @@ -0,0 +1,15 @@ +--- +features: + - | + Make the ``idrac`` hardware type inherit from the ``redfish`` hardware + type since the ``idrac`` hardware type is an extension of the ``redfish`` + with Dell specific overrides. This will ensure that features available + to the ``redfish`` hardware type will always be available to ``idrac``. + Added ``redfish`` interface as available for the ``bios``, ``power`` + and ``vendor`` interfaces of the ``idrac`` hardware type. +deprecations: + - | + Deprecates the ``idrac-redfish`` interfaces in favor of the ``redfish`` + interfaces for the ``bios``, ``power``, and ``vendor`` interfaces. This + is a no-op change as these interfaces wrapped the ``redfish`` interface + with no change already.