Remove deprecated idrac wsman driver interfaces

Change-Id: I70738db25fdf9902575ac92195c3a40f1d7a0976
This commit is contained in:
Julia Kreger 2024-06-19 09:46:50 -07:00
parent f14794ca2e
commit 578f24bf18
26 changed files with 64 additions and 8952 deletions

View File

@ -5,17 +5,12 @@ iDRAC driver
Overview
========
.. warning::
The ``-wsman`` driver interfaces have been deprecated and are anticipated
to be removed from Ironic at some point during or after the 2024.2
development cycle. The anticipated forward management path is to migrate
to the ``-redfish`` driver interfaces or the ``redfish`` hardware type.
The integrated Dell Remote Access Controller (iDRAC_) is an out-of-band
management platform on Dell EMC servers, and is supported directly by
the ``idrac`` hardware type. This driver uses the Dell Web Services for
Management (WSMAN) protocol and the standard Distributed Management Task
Force (DMTF) Redfish protocol to perform all of its functions.
the ``idrac`` hardware type. This driver utilizes the Distributed
Management Task Force (DMTF) Redfish protocol to perform all of it's
functions. In older versions of Ironic, this driver leveraged
Web Services for Management (WSMAN) protocol.
iDRAC_ hardware is also supported by the generic ``ipmi`` and ``redfish``
hardware types, though with smaller feature sets.
@ -38,19 +33,12 @@ The ``idrac`` hardware type supports the following Ironic interfaces:
* `Management Interface`_: Boot device and firmware management
* Power Interface: Power management
* `RAID Interface`_: RAID controller and disk management
* `Vendor Interface`_: BIOS management (WSMAN) and eject virtual media
(Redfish)
* `Vendor Interface`_: eject virtual media (Redfish)
Prerequisites
-------------
The ``idrac`` hardware type requires the ``python-dracclient`` library
to be installed on the ironic conductor node(s) if an Ironic node is
configured to use an ``idrac-wsman`` interface implementation, for example::
sudo pip install 'python-dracclient>=3.1.0'
Additionally, the ``idrac`` hardware type requires the ``sushy`` library
The ``idrac`` hardware type requires the ``sushy`` library
to be installed on the ironic conductor node(s) if an Ironic node is
configured to use an ``idrac-redfish`` interface implementation, for example::
@ -59,28 +47,24 @@ configured to use an ``idrac-redfish`` interface implementation, for example::
Enabling
--------
The iDRAC driver supports WSMAN for the bios, inspect, management, power,
raid, and vendor interfaces. In addition, it supports Redfish for
the bios, inspect, management, power, and raid interfaces. The iDRAC driver
allows you to mix and match WSMAN and Redfish interfaces.
The iDRAC driver supports Redfish for the bios, inspect, management, power,
and raid interfaces.
The ``idrac-wsman`` implementation must be enabled to use WSMAN for
an interface. The ``idrac-redfish`` implementation must be enabled
The ``idrac-redfish`` implementation must be enabled
to use Redfish for an interface.
To enable the ``idrac`` hardware type with the minimum interfaces,
all using WSMAN, add the following to your ``/etc/ironic/ironic.conf``:
To enable the ``idrac`` hardware type, add the following to your
``/etc/ironic/ironic.conf``:
.. code-block:: ini
[DEFAULT]
enabled_hardware_types=idrac
enabled_management_interfaces=idrac-wsman
enabled_power_interfaces=idrac-wsman
enabled_management_interfaces=idrac-redfish
enabled_power_interfaces=idrac-redfish
To enable all optional features (BIOS, inspection, RAID, and vendor passthru)
using Redfish where it is supported and WSMAN where not, use the
following configuration:
To enable all optional features (BIOS, inspection, RAID, and vendor passthru),
use the following configuration:
.. code-block:: ini
@ -100,43 +84,30 @@ order:
================ ===================================================
Interface Supported Implementations
================ ===================================================
``bios`` ``idrac-wsman``, ``idrac-redfish``, ``no-bios``
``bios`` ``idrac-redfish``, ``no-bios``
``boot`` ``ipxe``, ``pxe``, ``idrac-redfish-virtual-media``
``console`` ``no-console``
``deploy`` ``direct``, ``ansible``, ``ramdisk``
``firmware`` ``redfish``, ``no-firmware``
``inspect`` ``idrac-wsman``, ``idrac``, ``idrac-redfish``,
``inspect`` ``idrac-redfish``,
``inspector``, ``no-inspect``
``management`` ``idrac-wsman``, ``idrac``, ``idrac-redfish``
``management`` ``idrac-redfish``
``network`` ``flat``, ``neutron``, ``noop``
``power`` ``idrac-wsman``, ``idrac``, ``idrac-redfish``
``raid`` ``idrac-wsman``, ``idrac``, ``idrac-redfish``, ``no-raid``
``power`` ``idrac-redfish``
``raid`` ``idrac-redfish``, ``no-raid``
``rescue`` ``no-rescue``, ``agent``
``storage`` ``noop``, ``cinder``, ``external``
``vendor`` ``idrac-wsman``, ``idrac``, ``idrac-redfish``,
``vendor`` ``idrac-redfish``,
``no-vendor``
================ ===================================================
.. NOTE::
``idrac`` is the legacy name of the WSMAN interface. It has been
deprecated in favor of ``idrac-wsman`` and may be removed in a
future release.
Protocol-specific Properties
----------------------------
The WSMAN and Redfish protocols require different properties to be specified
The Redfish protocols require different properties to be specified
in the Ironic node's ``driver_info`` field to communicate with the bare
metal system's iDRAC.
The WSMAN protocol requires the following properties:
* ``drac_username``: The WSMAN user name to use when communicating
with the iDRAC. Usually ``root``.
* ``drac_password``: The password for the WSMAN user to use when
communicating with the iDRAC.
* ``drac_address``: The IP address of the iDRAC.
The Redfish protocol requires the following properties:
* ``redfish_username``: The Redfish user name to use when
@ -151,25 +122,9 @@ The Redfish protocol requires the following properties:
For other Redfish protocol parameters see :doc:`/admin/drivers/redfish`.
If using only interfaces which use WSMAN (``idrac-wsman``), then only
the WSMAN properties must be supplied. If using only interfaces which
use Redfish (``idrac-redfish``), then only the Redfish properties must be
supplied. If using a mix of interfaces, where some use WSMAN and others
use Redfish, both the WSMAN and Redfish properties must be supplied.
Enrolling
---------
The following command enrolls a bare metal node with the ``idrac``
hardware type using WSMAN for all interfaces:
.. code-block:: bash
baremetal node create --driver idrac \
--driver-info drac_username=user \
--driver-info drac_password=pa$$w0rd \
--driver-info drac_address=drac.host
The following command enrolls a bare metal node with the ``idrac``
hardware type using Redfish for all interfaces:
@ -187,29 +142,6 @@ hardware type using Redfish for all interfaces:
--raid-interface idrac-redfish \
--vendor-interface idrac-redfish
The following command enrolls a bare metal node with the ``idrac``
hardware type assuming a mix of Redfish and WSMAN interfaces are used:
.. code-block:: bash
baremetal node create --driver idrac \
--driver-info drac_username=user \
--driver-info drac_password=pa$$w0rd
--driver-info drac_address=drac.host \
--driver-info redfish_username=user \
--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 \
--inspect-interface idrac-redfish \
--management-interface idrac-redfish \
--power-interface idrac-redfish
.. NOTE::
If using WSMAN for the management interface, then WSMAN must be used
for the power interface. The same applies to Redfish. It is currently not
possible to use Redfish for one and WSMAN for the other.
BIOS Interface
==============
@ -252,7 +184,7 @@ Inspect Interface
The Dell iDRAC out-of-band inspection process catalogs all the same
attributes of the server as the IPMI driver. Unlike IPMI, it does this
without requiring the system to be rebooted, or even to be powered on.
Inspection is performed using the Dell WSMAN or Redfish protocol directly
Inspection is performed using the Redfish protocol directly
without affecting the operation of the system being inspected.
The inspection discovers the following properties:
@ -267,8 +199,6 @@ Extra capabilities:
* ``pci_gpu_devices``: number of GPU devices connected to the bare metal.
It also creates baremetal ports for each NIC port detected in the system.
The ``idrac-wsman`` inspect interface discovers which NIC ports are
configured to PXE boot and sets ``pxe_enabled`` to ``True`` on those ports.
The ``idrac-redfish`` inspect interface does not currently set ``pxe_enabled``
on the ports. The user should ensure that ``pxe_enabled`` is set correctly on
the ports following inspection with the ``idrac-redfish`` inspect interface.
@ -487,7 +417,7 @@ Compared to ``redfish`` RAID interface, using ``idrac-redfish`` adds:
* Converting non-RAID disks to RAID mode if there are any,
* Clearing foreign configuration, if any, after deleting virtual disks.
The following properties are supported by the iDRAC WSMAN and Redfish RAID
The following properties are supported by the Redfish RAID
interface implementation:
.. NOTE::
@ -633,223 +563,6 @@ Or using ``sushy`` with Redfish:
Vendor Interface
================
idrac-wsman
-----------
Dell iDRAC BIOS management is available through the Ironic WSMAN vendor
passthru interface.
======================== ============ ======================================
Method Name HTTP Method Description
======================== ============ ======================================
``abandon_bios_config`` ``DELETE`` Abandon a BIOS configuration job.
``commit_bios_config`` ``POST`` Commit a BIOS configuration job
submitted through ``set_bios_config``.
Required argument: ``reboot`` -
indicates whether a reboot job
should be automatically created
with the config job. Returns a
dictionary containing the ``job_id``
key with the ID of the newly created
config job, and the
``reboot_required`` key indicating
whether the node needs to be rebooted
to execute the config job.
``get_bios_config`` ``GET`` Returns a dictionary containing the
node's BIOS settings.
``list_unfinished_jobs`` ``GET`` Returns a dictionary containing
the key ``unfinished_jobs``; its value
is a list of dictionaries. Each
dictionary represents an unfinished
config job object.
``set_bios_config`` ``POST`` Change the BIOS configuration on
a node. Required argument: a
dictionary of {``AttributeName``:
``NewValue``}. Returns a dictionary
containing the ``is_commit_required``
key indicating whether
``commit_bios_config`` needs to be
called to apply the changes and the
``is_reboot_required`` value
indicating whether the server must
also be rebooted. Possible values are
``true`` and ``false``.
======================== ============ ======================================
Examples
^^^^^^^^
Get BIOS Config
~~~~~~~~~~~~~~~
.. code-block:: bash
baremetal node passthru call --http-method GET <node> get_bios_config
Snippet of output showing virtualization enabled:
.. code-block:: json
{"ProcVirtualization": {
"current_value": "Enabled",
"instance_id": "BIOS.Setup.1-1:ProcVirtualization",
"name": "ProcVirtualization",
"pending_value": null,
"possible_values": [
"Enabled",
"Disabled"],
"read_only": false }}
There are a number of items to note from the above snippet:
* ``name``: this is the name to use in a call to ``set_bios_config``.
* ``current_value``: the current state of the setting.
* ``pending_value``: if the value has been set, but not yet committed,
the new value is shown here. The change can either be committed or
abandoned.
* ``possible_values``: shows a list of valid values which can be used
in a call to ``set_bios_config``.
* ``read_only``: indicates if the value is capable of being changed.
Set BIOS Config
~~~~~~~~~~~~~~~
.. code-block:: bash
baremetal node passthru call <node> set_bios_config --arg "name=value"
Walkthrough of performing a BIOS configuration change:
The following section demonstrates how to change BIOS configuration settings,
detect that a commit and reboot are required, and act on them accordingly. The
two properties that are being changed are:
* Enable virtualization technology of the processor
* Globally enable SR-IOV
.. code-block:: bash
baremetal node passthru call <node> set_bios_config \
--arg "ProcVirtualization=Enabled" \
--arg "SriovGlobalEnable=Enabled"
This returns a dictionary indicating what actions are required next:
.. code-block:: json
{
"is_reboot_required": true,
"is_commit_required": true
}
Commit BIOS Changes
~~~~~~~~~~~~~~~~~~~
The next step is to commit the pending change to the BIOS. Note that in this
example, the ``reboot`` argument is set to ``true``. The response indicates
that a reboot is no longer required as it has been scheduled automatically
by the ``commit_bios_config`` call. If the reboot argument is not supplied,
the job is still created, however it remains in the ``scheduled`` state
until a reboot is performed. The reboot can be initiated through the
Ironic power API.
.. code-block:: bash
baremetal node passthru call <node> commit_bios_config \
--arg "reboot=true"
.. code-block:: json
{
"job_id": "JID_499377293428",
"reboot_required": false
}
The state of any executing job can be queried:
.. code-block:: bash
baremetal node passthru call --http-method GET <node> list_unfinished_jobs
.. code-block:: json
{"unfinished_jobs":
[{"status": "Scheduled",
"name": "ConfigBIOS:BIOS.Setup.1-1",
"until_time": "TIME_NA",
"start_time": "TIME_NOW",
"message": "Task successfully scheduled.",
"percent_complete": "0",
"id": "JID_499377293428"}]}
Abandon BIOS Changes
~~~~~~~~~~~~~~~~~~~~
Instead of committing, a pending change can be abandoned:
.. code-block:: bash
baremetal node passthru call --http-method DELETE <node> abandon_bios_config
The abandon command does not provide a response body.
Change Boot Mode
^^^^^^^^^^^^^^^^
The boot mode of the iDRAC can be changed to:
* BIOS - Also called legacy or traditional boot mode. The BIOS initializes the
systems processors, memory, bus controllers, and I/O devices. After
initialization is complete, the BIOS passes control to operating system (OS)
software. The OS loader uses basic services provided by the system BIOS to
locate and load OS modules into system memory. After booting the system, the
BIOS and embedded management controllers execute system management
algorithms, which monitor and optimize the condition of the underlying
hardware. BIOS configuration settings enable fine-tuning of the
performance, power management, and reliability features of the system.
* UEFI - The Unified Extensible Firmware Interface does not change the
traditional purposes of the system BIOS. To a large extent, a UEFI-compliant
BIOS performs the same initialization, boot, configuration, and management
tasks as a traditional BIOS. However, UEFI does change the interfaces and
data structures the BIOS uses to interact with I/O device firmware and
operating system software. The primary intent of UEFI is to eliminate
shortcomings in the traditional BIOS environment, enabling system firmware to
continue scaling with industry trends.
The UEFI boot mode offers:
* Improved partitioning scheme for boot media
* Support for media larger than 2 TB
* Redundant partition tables
* Flexible handoff from BIOS to OS
* Consolidated firmware user interface
* Enhanced resource allocation for boot device firmware
The boot mode can be changed via the WSMAN vendor passthru interface as
follows:
.. code-block:: bash
baremetal node passthru call <node> set_bios_config \
--arg "BootMode=Uefi"
baremetal node passthru call <node> commit_bios_config \
--arg "reboot=true"
.. code-block:: bash
baremetal node passthru call <node> set_bios_config \
--arg "BootMode=Bios"
baremetal node passthru call <node> commit_bios_config \
--arg "reboot=true"
idrac-redfish
-------------
@ -896,27 +609,6 @@ settings.
.. _Ironic_RAID: https://docs.openstack.org/ironic/latest/admin/raid.html
.. _iDRAC: https://www.dell.com/idracmanuals
WSMAN vendor passthru timeout
-----------------------------
When iDRAC is not ready and executing WSMAN vendor passthru commands, they take
more time as waiting for iDRAC to become ready again and then time out,
for example:
.. code-block:: bash
baremetal node passthru call --http-method GET \
aed58dca-1b25-409a-a32f-3a817d59e1e0 list_unfinished_jobs
Timed out waiting for a reply to message ID 547ce7995342418c99ef1ea4a0054572 (HTTP 500)
To avoid this need to increase timeout for messaging in ``/etc/ironic/ironic.conf``
and restart Ironic API service.
.. code-block:: ini
[DEFAULT]
rpc_response_timeout = 600
Timeout when powering off
-------------------------

View File

@ -9,7 +9,6 @@ pysnmp-lextudio>=5.0.0 # BSD
pyasn1>=0.5.1 # BSD
pyasn1-modules>=0.3.0 # BSD
python-scciclient>=0.16.0,<0.17.0
python-dracclient>=5.1.0,<9.0.0
# Ansible-deploy interface
ansible>=2.7

View File

@ -47,20 +47,19 @@ class IDRACHardware(generic.GenericHardware):
@property
def supported_management_interfaces(self):
"""List of supported management interfaces."""
return [management.DracWSManManagement, management.DracManagement,
management.DracRedfishManagement]
return [management.DracRedfishManagement]
@property
def supported_power_interfaces(self):
"""List of supported power interfaces."""
return [power.DracWSManPower, power.DracPower, power.DracRedfishPower]
return [power.DracRedfishPower]
# Optional hardware interfaces
@property
def supported_bios_interfaces(self):
"""List of supported bios interfaces."""
return [bios.DracWSManBIOS, bios.DracRedfishBIOS, noop.NoBIOS]
return [bios.DracRedfishBIOS, noop.NoBIOS]
@property
def supported_firmware_interfaces(self):
@ -72,20 +71,17 @@ 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.DracWSManInspect, drac_inspect.DracInspect,
drac_inspect.DracRedfishInspect] + super(
IDRACHardware, self).supported_inspect_interfaces
return [drac_inspect.DracRedfishInspect] + super(
IDRACHardware, self).supported_inspect_interfaces
@property
def supported_raid_interfaces(self):
"""List of supported raid interfaces."""
return [raid.DracWSManRAID, raid.DracRAID,
raid.DracRedfishRAID] + super(
IDRACHardware, self).supported_raid_interfaces
return [raid.DracRedfishRAID] + super(
IDRACHardware, self).supported_raid_interfaces
@property
def supported_vendor_interfaces(self):
"""List of supported vendor interfaces."""
return [vendor_passthru.DracWSManVendorPassthru,
vendor_passthru.DracVendorPassthru,
vendor_passthru.DracRedfishVendorPassthru, noop.NoVendor]
return [vendor_passthru.DracRedfishVendorPassthru,
noop.NoVendor]

View File

@ -15,31 +15,7 @@
DRAC BIOS configuration specific methods
"""
from ironic_lib import metrics_utils
from oslo_log import log as logging
from oslo_utils import importutils
from oslo_utils import timeutils
from ironic.common import exception
from ironic.common.i18n import _
from ironic.conductor import periodics
from ironic.conductor import utils as manager_utils
from ironic.conf import CONF
from ironic.drivers import base
from ironic.drivers.modules import deploy_utils
from ironic.drivers.modules.drac import common as drac_common
from ironic.drivers.modules.drac import job as drac_job
from ironic.drivers.modules.redfish import bios as redfish_bios
from ironic import objects
drac_client = importutils.try_import('dracclient.client')
drac_exceptions = importutils.try_import('dracclient.exceptions')
drac_uris = importutils.try_import('dracclient.resources.uris')
drac_utils = importutils.try_import('dracclient.utils')
LOG = logging.getLogger(__name__)
METRICS = metrics_utils.get_metrics_logger(__name__)
class DracRedfishBIOS(redfish_bios.RedfishBIOS):
@ -50,600 +26,3 @@ class DracRedfishBIOS(redfish_bios.RedfishBIOS):
specific incompatibilities and introduction of vendor value added
should be implemented by this class.
"""
class DracWSManBIOS(base.BIOSInterface):
"""BIOSInterface Implementation for iDRAC."""
# NOTE(TheJulia): Deprecating November 2023 in favor of Redfish
# and due to a lack of active driver maintenance.
supported = False
# argsinfo dict for BIOS clean/deploy steps
_args_info = {
"settings": {
"description": "List of BIOS settings to apply",
"required": True
}
}
def __init__(self):
super(DracWSManBIOS, self).__init__()
if drac_exceptions is None:
raise exception.DriverLoadError(
driver='idrac',
reason=_("Unable to import dracclient.exceptions library"))
@METRICS.timer('DracWSManBIOS.apply_configuration')
@base.clean_step(priority=0, argsinfo=_args_info, requires_ramdisk=False)
@base.deploy_step(priority=0, argsinfo=_args_info)
def apply_configuration(self, task, settings):
"""Apply the BIOS configuration to the node
:param task: a TaskManager instance containing the node to act on
:param settings: List of BIOS settings to apply
:raises: DRACOperationError upon an error from python-dracclient
:returns: states.CLEANWAIT (cleaning) or states.DEPLOYWAIT (deployment)
if configuration is in progress asynchronously or None if it
is completed.
"""
LOG.debug("Configuring node %(node_uuid)s with BIOS settings:"
" %(settings)s", {"node_uuid": task.node.uuid,
"settings": settings})
node = task.node
# convert ironic settings list to DRAC kwsettings
kwsettings = {s['name']: s['value'] for s in settings}
drac_job.validate_job_queue(node)
client = drac_common.get_drac_client(node)
try:
# Argument validation is done by the dracclient method
# set_bios_settings. No need to do it here.
set_result = client.set_bios_settings(kwsettings)
except drac_exceptions.BaseClientException as exc:
LOG.error("Failed to apply BIOS config on node %(node_uuid)s."
" Error %(error)s", {"node_uuid": task.node.uuid,
"error": exc})
raise exception.DracOperationError(error=exc)
# If no commit is required, we're done
if not set_result['is_commit_required']:
LOG.info("Completed BIOS configuration on node %(node_uuid)s"
" with BIOS settings: %(settings)s",
{
"node_uuid": task.node.uuid,
"settings": settings
})
return
# Otherwise, need to reboot the node as well to commit configuration
else:
LOG.debug("Rebooting node %(node_uuid)s to apply BIOS settings",
{"node_uuid": task.node.uuid})
reboot_needed = set_result['is_reboot_required']
try:
commit_result = client.commit_pending_bios_changes(
reboot=reboot_needed)
except drac_exceptions.BaseClientException as exc:
LOG.error("Failed to commit BIOS changes on node %(node_uuid)s"
". Error %(error)s", {"node_uuid": task.node.uuid,
"error": exc})
raise exception.DracOperationError(error=exc)
# Store JobID for the async job handler _check_node_bios_jobs
bios_config_job_ids = node.driver_internal_info.get(
'bios_config_job_ids', [])
bios_config_job_ids.append(commit_result)
node.set_driver_internal_info('bios_config_job_ids',
bios_config_job_ids)
# This method calls node.save(), bios_config_job_ids will then be
# saved.
# These flags are for the conductor to manage the asynchronous
# jobs that have been initiated by this method
deploy_utils.set_async_step_flags(
node,
reboot=reboot_needed,
skip_current_step=True,
polling=True)
# Return the clean/deploy state string
return deploy_utils.get_async_step_return_state(node)
@METRICS.timer('DracWSManBIOS._query_bios_config_job_status')
# TODO(noor): Consider patch of CONF to add an entry for BIOS query
# spacing since BIOS jobs could be comparatively shorter in time than
# RAID ones currently using the raid spacing to avoid errors
# spacing parameter for periodic method
@periodics.node_periodic(
purpose='checking async bios configuration jobs',
spacing=CONF.drac.query_raid_config_job_status_interval,
filters={'reserved': False, 'maintenance': False},
predicate_extra_fields=['driver_internal_info'],
predicate=lambda n: (
n.driver_internal_info.get('bios_config_job_ids')
or n.driver_internal_info.get('factory_reset_time_before_reboot')),
)
def _query_bios_config_job_status(self, task, manager, context):
"""Periodic task to check the progress of running BIOS config jobs.
:param manager: an instance of Ironic Conductor Manager with
the node list to act on
:param context: context of the request, needed when acquiring
a lock on a node. For access control.
"""
# check bios_config_job_id exist & checks job is completed
if task.node.driver_internal_info.get("bios_config_job_ids"):
self._check_node_bios_jobs(task)
if task.node.driver_internal_info.get(
"factory_reset_time_before_reboot"):
self._check_last_system_inventory_changed(task)
def _check_last_system_inventory_changed(self, task):
"""Check the progress of last system inventory time of a node.
This handles jobs for BIOS factory reset. Handle means,
it checks for job status to not only signify completed jobs but
also handle failures by invoking the 'fail' event, allowing the
conductor to put the node into clean/deploy FAIL state.
:param task: a TaskManager instance with the node to act on
"""
node = task.node
client = drac_common.get_drac_client(node)
# Get the last system inventory time from node before reboot
factory_reset_time_before_reboot = node.driver_internal_info.get(
'factory_reset_time_before_reboot')
# Get the factory reset start time
factory_reset_time = node.driver_internal_info.get(
'factory_reset_time')
LOG.debug("Factory resetting node %(node_uuid)s factory reset time "
" %(factory_reset_time)s", {"node_uuid": task.node.uuid,
"factory_reset_time":
factory_reset_time})
# local variable to track difference between current time and factory
# reset start time
time_difference = 0
# Get the last system inventory time after reboot
factory_reset_time_endof_reboot = (client.get_system()
.last_system_inventory_time)
LOG.debug("Factory resetting node %(node_uuid)s "
"last inventory reboot time after factory reset "
"%(factory_reset_time_endof_reboot)s",
{"node_uuid": task.node.uuid,
"factory_reset_time_endof_reboot":
factory_reset_time_endof_reboot})
if factory_reset_time_before_reboot != factory_reset_time_endof_reboot:
# from the database cleanup with factory reset time
self._delete_cached_reboot_time(node)
# Cache the new BIOS settings,
self.cache_bios_settings(task)
self._resume_current_operation(task)
else:
# Calculate difference between current time and factory reset
# start time if it is more than configured timeout then set
# the node to fail state
time = timeutils.utcnow(with_timezone=True
) - timeutils.parse_isotime(str(
factory_reset_time))
time_difference = time.total_seconds()
LOG.debug("Factory resetting node %(node_uuid)s "
"time difference %(time_difference)s ",
{"node_uuid": task.node.uuid, "time_difference":
time_difference})
if time_difference > CONF.drac.bios_factory_reset_timeout:
task.upgrade_lock()
self._delete_cached_reboot_time(node)
error_message = ("BIOS factory reset was not completed within "
"{} seconds, unable to cache updated bios "
"setting").format(
CONF.drac.bios_factory_reset_timeout)
self._set_failed(task, error_message)
else:
LOG.debug("Factory reset for a node %(node)s is not done "
"will check again later", {'node': task.node.uuid})
def _check_node_bios_jobs(self, task):
"""Check the progress of running BIOS config jobs of a node.
This handles jobs for BIOS set and reset. Handle means,
it checks for job status to not only signify completed jobs but
also handle failures by invoking the 'fail' event, allowing the
conductor to put the node into clean/deploy FAIL state.
:param task: a TaskManager instance with the node to act on
"""
node = task.node
bios_config_job_ids = node.driver_internal_info['bios_config_job_ids']
finished_job_ids = []
# local variable to track job failures
job_failed = False
for config_job_id in bios_config_job_ids:
config_job = drac_job.get_job(node, job_id=config_job_id)
if config_job is None or config_job.status == 'Completed':
finished_job_ids.append(config_job_id)
elif (config_job.status == 'Failed'
or config_job.status == 'Completed with Errors'):
finished_job_ids.append(config_job_id)
job_failed = True
# If no job has finished, return
if not finished_job_ids:
return
# The finished jobs will require a node reboot, need to update the
# node lock to exclusive, allowing a destructive reboot operation
task.upgrade_lock()
# Cleanup the database with finished jobs, they're no longer needed
self._delete_cached_config_job_ids(node, finished_job_ids)
if not job_failed:
# Cache the new BIOS settings, caching needs to happen here
# since the config steps are async. Decorator won't work.
self.cache_bios_settings(task)
# if no failure, continue with clean/deploy
self._resume_current_operation(task)
else:
# invoke 'fail' event to allow conductor to put the node in
# a clean/deploy fail state
error_message = ("Failed config job: {}. Message: '{}'.".format(
config_job.id, config_job.message))
self._set_failed(task, error_message)
def _delete_cached_config_job_ids(self, node, finished_job_ids=None):
"""Remove Job IDs from the driver_internal_info table in database.
:param node: an ironic node object
:param finished_job_ids: a list of finished Job ID strings to remove
"""
if finished_job_ids is None:
finished_job_ids = []
# take out the unfinished job ids from all the jobs
unfinished_job_ids = [
job_id for job_id
in node.driver_internal_info['bios_config_job_ids']
if job_id not in finished_job_ids]
# assign the unfinished job ids back to the total list
# this will clear the finished jobs from the list
node.set_driver_internal_info('bios_config_job_ids',
unfinished_job_ids)
node.save()
def _delete_cached_reboot_time(self, node):
"""Remove factory time from the driver_internal_info table in database.
:param node: an ironic node object
"""
# Remove the last reboot time and factory reset time
node.del_driver_internal_info('factory_reset_time_before_reboot')
node.del_driver_internal_info('factory_reset_time')
node.save()
def _set_failed(self, task, error_message):
"""Set the node in failed state by invoking 'fail' event.
:param task: a TaskManager instance with node to act on
:param error_message: Error message
"""
log_msg = ("BIOS configuration failed for node %(node)s. %(error)s " %
{'node': task.node.uuid,
'error': error_message})
if task.node.clean_step:
manager_utils.cleaning_error_handler(task, log_msg, error_message)
else:
manager_utils.deploying_error_handler(task, log_msg, error_message)
def _resume_current_operation(self, task):
"""Continue cleaning/deployment of the node.
For asynchronous operations, it is necessary to notify the
conductor manager to continue the cleaning/deployment operation
after a job has finished. This is done through an RPC call. The
notify_conductor_resume_* wrapper methods provide that.
:param task: a TaskManager instance with node to act on
"""
if task.node.clean_step:
manager_utils.notify_conductor_resume_clean(task)
else:
manager_utils.notify_conductor_resume_deploy(task)
@METRICS.timer('DracWSManBIOS.factory_reset')
@base.clean_step(priority=0, requires_ramdisk=False)
@base.deploy_step(priority=0)
def factory_reset(self, task):
"""Reset the BIOS settings of the node to the factory default.
This uses the Lifecycle Controller configuration to perform
BIOS configuration reset. Leveraging the python-dracclient
methods already available.
:param task: a TaskManager instance containing the node to act on
:raises: DracOperationError on an error from python-dracclient
:returns: states.CLEANWAIT (cleaning) or states.DEPLOYWAIT
(deployment) if reset is in progress asynchronously or None
if it is completed.
"""
node = task.node
drac_job.validate_job_queue(node)
client = drac_common.get_drac_client(node)
lc_bios_reset_attrib = {
"BIOS Reset To Defaults Requested": "True"
}
try:
set_result = client.set_lifecycle_settings(lc_bios_reset_attrib)
except drac_exceptions.BaseClientException as exc:
LOG.error('Failed to reset BIOS on the node %(node_uuid)s.'
' Reason: %(error)s.', {'node_uuid': node.uuid,
'error': exc})
raise exception.DracOperationError(error=exc)
if not set_result['is_commit_required']:
LOG.info("BIOS reset successful on the node "
"%(node_uuid)s", {"node_uuid": node.uuid})
return
else:
# Rebooting the Node is compulsory, LC call returns
# reboot_required=False/Optional, which is not desired
reboot_needed = True
try:
factory_reset_time_before_reboot =\
client.get_system().last_system_inventory_time
LOG.debug("Factory resetting node %(node_uuid)s "
"last inventory reboot time before factory reset "
"%(factory_reset_time_before_reboot)s",
{"node_uuid": task.node.uuid,
"factory_reset_time_before_reboot":
factory_reset_time_before_reboot})
commit_job_id = client.commit_pending_lifecycle_changes(
reboot=reboot_needed)
LOG.info("Commit job id of a node %(node_uuid)s."
"%(commit_job_id)s", {'node_uuid': node.uuid,
"commit_job_id": commit_job_id})
except drac_exceptions.BaseClientException as exc:
LOG.error('Failed to commit BIOS reset on node '
'%(node_uuid)s. Reason: %(error)s.', {
'node_uuid': node.uuid,
'error': exc})
raise exception.DracOperationError(error=exc)
# Store the last inventory time on reboot for async job handler
# _check_last_system_inventory_changed
node.set_driver_internal_info('factory_reset_time_before_reboot',
factory_reset_time_before_reboot)
# Store the current time to later check if factory reset times out
node.timestamp_driver_internal_info('factory_reset_time')
# rebooting the server to apply factory reset value
task.driver.power.reboot(task)
# This method calls node.save(), bios_config_job_id will be
# saved automatically
# These flags are for the conductor to manage the asynchronous
# jobs that have been initiated by this method
deploy_utils.set_async_step_flags(
node,
reboot=reboot_needed,
skip_current_step=True,
polling=True)
return deploy_utils.get_async_step_return_state(task.node)
def cache_bios_settings(self, task):
"""Store or update the current BIOS settings for the node.
Get the current BIOS settings and store them in the bios_settings
database table.
:param task: a TaskManager instance containing the node to act on.
:raises: DracOperationError on an error from python-dracclient
"""
node = task.node
node_id = node.id
node_uuid = node.uuid
client = drac_common.get_drac_client(node)
try:
kwsettings = client.list_bios_settings()
except drac_exceptions.BaseClientException as exc:
LOG.error('DRAC driver failed to get the BIOS settings for node '
'%(node_uuid)s. Reason: %(error)s.',
{'node_uuid': node.uuid,
'error': exc})
raise exception.DracOperationError(error=exc)
# convert dracclient BIOS settings into ironic settings list
settings = [{"name": name, "value": attrib.current_value}
for name, attrib in kwsettings.items()]
# Store them in the database table
LOG.debug('Caching BIOS settings for node %(node_uuid)s', {
'node_uuid': node_uuid})
create_list, update_list, delete_list, nochange_list = (
objects.BIOSSettingList.sync_node_setting(
task.context, node_id, settings))
if create_list:
objects.BIOSSettingList.create(
task.context, node_id, create_list)
if update_list:
objects.BIOSSettingList.save(
task.context, node_id, update_list)
if delete_list:
delete_names = [d['name'] for d in delete_list]
objects.BIOSSettingList.delete(
task.context, node_id, delete_names)
# BaseInterface methods implementation
def get_properties(self):
"""Return the properties of the BIOS Interface
:returns: dictionary of <property name>: <property description> entries
"""
return drac_common.COMMON_PROPERTIES
def validate(self, task):
"""Validates the driver-specific information used by the idrac BMC
:param task: a TaskManager instance containing the node to act on
:raises: InvalidParameterValue if some mandatory information
is missing on the node or on invalid inputs
"""
drac_common.parse_driver_info(task.node)
def get_config(node):
"""Get the BIOS configuration.
The BIOS settings look like::
{'EnumAttrib': {'name': 'EnumAttrib',
'current_value': 'Value',
'pending_value': 'New Value', # could also be None
'read_only': False,
'possible_values': ['Value', 'New Value', 'None']},
'StringAttrib': {'name': 'StringAttrib',
'current_value': 'Information',
'pending_value': None,
'read_only': False,
'min_length': 0,
'max_length': 255,
'pcre_regex': '^[0-9A-Za-z]{0,255}$'},
'IntegerAttrib': {'name': 'IntegerAttrib',
'current_value': 0,
'pending_value': None,
'read_only': True,
'lower_bound': 0,
'upper_bound': 65535}}
:param node: an ironic node object.
:raises: DracOperationError on an error from python-dracclient.
:returns: a dictionary containing BIOS settings
The above values are only examples, of course. BIOS attributes exposed via
this API will always be either an enumerated attribute, a string attribute,
or an integer attribute. All attributes have the following parameters:
:param name: is the name of the BIOS attribute.
:param current_value: is the current value of the attribute.
It will always be either an integer or a string.
:param pending_value: is the new value that we want the attribute to have.
None means that there is no pending value.
:param read_only: indicates whether this attribute can be changed.
Trying to change a read-only value will result in
an error. The read-only flag can change depending
on other attributes.
A future version of this call may expose the
dependencies that indicate when that may happen.
Enumerable attributes also have the following parameters:
:param possible_values: is an array of values it is permissible to set
the attribute to.
String attributes also have the following parameters:
:param min_length: is the minimum length of the string.
:param max_length: is the maximum length of the string.
:param pcre_regex: is a PCRE compatible regular expression that the string
must match. It may be None if the string is read only
or if the string does not have to match any particular
regular expression.
Integer attributes also have the following parameters:
:param lower_bound: is the minimum value the attribute can have.
:param upper_bound: is the maximum value the attribute can have.
"""
client = drac_common.get_drac_client(node)
try:
return client.list_bios_settings()
except drac_exceptions.BaseClientException as exc:
LOG.error('DRAC driver failed to get the BIOS settings for node '
'%(node_uuid)s. Reason: %(error)s.',
{'node_uuid': node.uuid,
'error': exc})
raise exception.DracOperationError(error=exc)
def set_config(task, **kwargs):
"""Sets the pending_value parameter for each of the values passed in.
:param task: a TaskManager instance containing the node to act on.
:param kwargs: a dictionary of {'AttributeName': 'NewValue'}
:raises: DracOperationError on an error from python-dracclient.
:returns: A dictionary containing the 'is_commit_required' key with a
boolean value indicating whether commit_config() needs to be
called to make the changes, and the 'is_reboot_required' key
which has a value of 'true' or 'false'. This key is used to
indicate to the commit_config() call if a reboot should be
performed.
"""
node = task.node
drac_job.validate_job_queue(node)
client = drac_common.get_drac_client(node)
if 'http_method' in kwargs:
del kwargs['http_method']
try:
return client.set_bios_settings(kwargs)
except drac_exceptions.BaseClientException as exc:
LOG.error('DRAC driver failed to set the BIOS settings for node '
'%(node_uuid)s. Reason: %(error)s.',
{'node_uuid': node.uuid,
'error': exc})
raise exception.DracOperationError(error=exc)
def commit_config(task, reboot=False):
"""Commits pending changes added by set_config
:param task: a TaskManager instance containing the node to act on.
:param reboot: indicates whether a reboot job should be automatically
created with the config job.
:raises: DracOperationError on an error from python-dracclient.
:returns: the job_id key with the id of the newly created config job.
"""
node = task.node
drac_job.validate_job_queue(node)
client = drac_common.get_drac_client(node)
try:
return client.commit_pending_bios_changes(reboot)
except drac_exceptions.BaseClientException as exc:
LOG.error('DRAC driver failed to commit the pending BIOS changes '
'for node %(node_uuid)s. Reason: %(error)s.',
{'node_uuid': node.uuid,
'error': exc})
raise exception.DracOperationError(error=exc)
def abandon_config(task):
"""Abandons uncommitted changes added by set_config
:param task: a TaskManager instance containing the node to act on.
:raises: DracOperationError on an error from python-dracclient.
"""
node = task.node
client = drac_common.get_drac_client(node)
try:
client.abandon_pending_bios_changes()
except drac_exceptions.BaseClientException as exc:
LOG.error('DRAC driver failed to delete the pending BIOS '
'settings for node %(node_uuid)s. Reason: %(error)s.',
{'node_uuid': node.uuid,
'error': exc})
raise exception.DracOperationError(error=exc)

View File

@ -1,117 +0,0 @@
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
"""
Common functionalities shared between different DRAC modules.
"""
from oslo_log import log as logging
from oslo_utils import importutils
from ironic.common import exception
from ironic.common.i18n import _
from ironic.common import utils
drac_client = importutils.try_import('dracclient.client')
drac_constants = importutils.try_import('dracclient.constants')
LOG = logging.getLogger(__name__)
REQUIRED_PROPERTIES = {
'drac_address': _('IP address or hostname of the DRAC card. Required.'),
'drac_username': _('username used for authentication. Required.'),
'drac_password': _('password used for authentication. Required.')
}
OPTIONAL_PROPERTIES = {
'drac_port': _('port used for WS-Man endpoint; default is 443. Optional.'),
'drac_path': _('path used for WS-Man endpoint; default is "/wsman". '
'Optional.'),
'drac_protocol': _('protocol used for WS-Man endpoint; one of http, https;'
' default is "https". Optional.'),
}
COMMON_PROPERTIES = REQUIRED_PROPERTIES.copy()
COMMON_PROPERTIES.update(OPTIONAL_PROPERTIES)
def parse_driver_info(node):
"""Parse a node's driver_info values.
Parses the driver_info of the node, reads default values
and returns a dict containing the combination of both.
:param node: an ironic node object.
:returns: a dict containing information from driver_info
and default values.
:raises: InvalidParameterValue if some mandatory information
is missing on the node or on invalid inputs.
"""
driver_info = node.driver_info
parsed_driver_info = {}
error_msgs = []
for param in REQUIRED_PROPERTIES:
try:
parsed_driver_info[param] = str(driver_info[param])
except KeyError:
error_msgs.append(_("'%s' not supplied to DracDriver.") % param)
except UnicodeEncodeError:
error_msgs.append(_("'%s' contains non-ASCII symbol.") % param)
parsed_driver_info['drac_port'] = driver_info.get('drac_port', 443)
try:
parsed_driver_info['drac_path'] = str(driver_info.get('drac_path',
'/wsman'))
except UnicodeEncodeError:
error_msgs.append(_("'drac_path' contains non-ASCII symbol."))
try:
parsed_driver_info['drac_protocol'] = str(
driver_info.get('drac_protocol', 'https'))
if parsed_driver_info['drac_protocol'] not in ['http', 'https']:
error_msgs.append(_("'drac_protocol' must be either 'http' or "
"'https'."))
except UnicodeEncodeError:
error_msgs.append(_("'drac_protocol' contains non-ASCII symbol."))
if error_msgs:
msg = (_('The following errors were encountered while parsing '
'driver_info:\n%s') % '\n'.join(error_msgs))
raise exception.InvalidParameterValue(msg)
port = parsed_driver_info['drac_port']
parsed_driver_info['drac_port'] = utils.validate_network_port(
port, 'drac_port')
return parsed_driver_info
def get_drac_client(node):
"""Returns a DRACClient object from python-dracclient library.
:param node: an ironic node object.
:returns: a DRACClient object.
:raises: InvalidParameterValue if mandatory information is missing on the
node or on invalid input.
"""
driver_info = parse_driver_info(node)
client = drac_client.DRACClient(driver_info['drac_address'],
driver_info['drac_username'],
driver_info['drac_password'],
driver_info['drac_port'],
driver_info['drac_path'],
driver_info['drac_protocol'])
return client

View File

@ -15,29 +15,12 @@
DRAC inspection interface
"""
from ironic_lib import metrics_utils
from oslo_log import log as logging
from oslo_utils import importutils
from oslo_utils import units
from ironic.common import boot_modes
from ironic.common import exception
from ironic.common.i18n import _
from ironic.common import states
from ironic.common import utils
from ironic.drivers import base
from ironic.drivers.modules.drac import common as drac_common
from ironic.drivers.modules.drac import utils as drac_utils
from ironic.drivers.modules import inspect_utils
from ironic.drivers.modules.redfish import inspect as redfish_inspect
from ironic.drivers.modules.redfish import utils as redfish_utils
from ironic import objects
drac_exceptions = importutils.try_import('dracclient.exceptions')
LOG = logging.getLogger(__name__)
METRICS = metrics_utils.get_metrics_logger(__name__)
_PXE_DEV_ENABLED_INTERFACES = [('PxeDev1EnDis', 'PxeDev1Interface'),
('PxeDev2EnDis', 'PxeDev2Interface'),
@ -63,8 +46,8 @@ class DracRedfishInspect(redfish_inspect.RedfishInspect):
"""
# Ensure we create a port for every NIC port found for consistency
# with our WSMAN inspect behavior and to work around a bug in some
# versions of the firmware where the port state is not being
# with our previous WSMAN inspect behavior and to work around a bug
# in some versions of the firmware where the port state is not being
# reported correctly.
ethernet_interfaces_mac = list(self._get_mac_address(task).values())
@ -124,218 +107,3 @@ class DracRedfishInspect(redfish_inspect.RedfishInspect):
pxe_port_macs = [mac for mac in pxe_port_macs_list]
return pxe_port_macs
class DracWSManInspect(base.InspectInterface):
_GPU_SUPPORTED_LIST = {"TU104GL [Tesla T4]",
"GV100GL [Tesla V100 PCIe 16GB]"}
def get_properties(self):
"""Return the properties of the interface.
:returns: dictionary of <property name>:<property description> entries.
"""
return drac_common.COMMON_PROPERTIES
@METRICS.timer('DracInspect.validate')
def validate(self, task):
"""Validate the driver-specific info supplied.
This method validates whether the 'driver_info' property of the
supplied node contains the required information for this driver to
manage the node.
:param task: a TaskManager instance containing the node to act on.
:raises: InvalidParameterValue if required driver_info attribute
is missing or invalid on the node.
"""
return drac_common.parse_driver_info(task.node)
@METRICS.timer('DracInspect.inspect_hardware')
def inspect_hardware(self, task):
"""Inspect hardware.
Inspect hardware to obtain the essential & additional hardware
properties.
:param task: a TaskManager instance containing the node to act on.
:raises: HardwareInspectionFailure, if unable to get essential
hardware properties.
:returns: states.MANAGEABLE
"""
node = task.node
client = drac_common.get_drac_client(node)
properties = {}
try:
properties['memory_mb'] = sum(
[memory.size_mb for memory in client.list_memory()])
cpus = client.list_cpus()
if cpus:
properties['cpu_arch'] = 'x86_64' if cpus[0].arch64 else 'x86'
bios_settings = client.list_bios_settings()
video_controllers = client.list_video_controllers()
current_capabilities = node.properties.get('capabilities', '')
new_capabilities = {
'boot_mode': bios_settings["BootMode"].current_value.lower(),
'pci_gpu_devices': self._calculate_gpus(video_controllers)}
capabilities = utils.get_updated_capabilities(current_capabilities,
new_capabilities)
properties['capabilities'] = capabilities
virtual_disks = client.list_virtual_disks()
root_disk = self._guess_root_disk(virtual_disks)
if root_disk:
properties['local_gb'] = int(root_disk.size_mb / units.Ki)
else:
physical_disks = client.list_physical_disks()
root_disk = self._guess_root_disk(physical_disks)
if root_disk:
properties['local_gb'] = int(
root_disk.size_mb / units.Ki)
except drac_exceptions.BaseClientException as exc:
LOG.error('DRAC driver failed to introspect node '
'%(node_uuid)s. Reason: %(error)s.',
{'node_uuid': node.uuid, 'error': exc})
raise exception.HardwareInspectionFailure(error=exc)
valid_keys = self.ESSENTIAL_PROPERTIES
missing_keys = valid_keys - set(properties)
if missing_keys:
error = (_('Failed to discover the following properties: '
'%(missing_keys)s') %
{'missing_keys': ', '.join(missing_keys)})
raise exception.HardwareInspectionFailure(error=error)
node.properties = dict(node.properties, **properties)
node.save()
try:
nics = client.list_nics()
except drac_exceptions.BaseClientException as exc:
LOG.error('DRAC driver failed to introspect node '
'%(node_uuid)s. Reason: %(error)s.',
{'node_uuid': node.uuid, 'error': exc})
raise exception.HardwareInspectionFailure(error=exc)
pxe_dev_nics = self._get_pxe_dev_nics(client, nics, node)
if pxe_dev_nics is None:
LOG.warning('No PXE enabled NIC was found for node '
'%(node_uuid)s.', {'node_uuid': node.uuid})
for nic in nics:
try:
port = objects.Port(task.context, address=nic.mac,
node_id=node.id,
pxe_enabled=(nic.id in pxe_dev_nics))
port.create()
LOG.info('Port created with MAC address %(mac)s '
'for node %(node_uuid)s during inspection',
{'mac': nic.mac, 'node_uuid': node.uuid})
except exception.MACAlreadyExists:
LOG.warning('Failed to create a port with MAC address '
'%(mac)s when inspecting the node '
'%(node_uuid)s because the address is already '
'registered',
{'mac': nic.mac, 'node_uuid': node.uuid})
LOG.info('Node %s successfully inspected.', node.uuid)
return states.MANAGEABLE
def _guess_root_disk(self, disks, min_size_required_mb=4 * units.Ki):
"""Find a root disk.
:param disks: list of disks.
:param min_size_required_mb: minimum required size of the root disk in
megabytes.
:returns: root disk.
"""
disks.sort(key=lambda disk: disk.size_mb)
for disk in disks:
if disk.size_mb >= min_size_required_mb:
return disk
def _calculate_gpus(self, video_controllers):
"""Find actual GPU count.
This method reports number of NVIDIA Tesla T4 GPU devices present
on the server.
:param video_controllers: list of video controllers.
:returns: returns total gpu count.
"""
gpu_cnt = 0
for video_controller in video_controllers:
for gpu in self._GPU_SUPPORTED_LIST:
if video_controller.description == gpu:
gpu_cnt += 1
return gpu_cnt