Future of classic drivers: update the migration proposal
As I started working on the migration implementation, it became apparent that the current proposal is not the best. This patch makes the following changes: 1. Do not calculate migration per node, but rather per driver. Doing it per node is not required for the current classic drivers. It complicates the database code and makes it potentially less efficient, because we need to fetch and update every node separately. 2. Return hardware type and interfaces separately from to_hardware_types. Also return interfaces without _interface suffix. This simplifies additional checks in the migration code. 3. Add support for options in migrations, and add an option to reset unsupported interfaces to no-<interface>. This is needed to make this migration more usable. For example, for ``pxe_ipmitool`` to be migrated under the current proposal, a deployment must have ``agent`` RAID and ``shellinabox`` console enabled, even if it does not use and/or does not support them. The new options will allow such deployments to have unsupported interfaces reset. Change-Id: I194be98bdd1f307ce6b9054a0037788f81cb0d23 Related-Bug: #1690185
This commit is contained in:
parent
3d7a3e8f73
commit
08b5820be4
@ -137,14 +137,14 @@ Queens release automatically update nodes.
|
||||
.. code-block:: python
|
||||
|
||||
@classmethod
|
||||
def to_hardware_type(cls, node):
|
||||
def to_hardware_type(cls):
|
||||
"""Return corresponding hardware type and hardware interfaces.
|
||||
|
||||
:param cls: the driver class
|
||||
:param node: node record from the database
|
||||
:returns: dictionary containing node fields to update: ``driver`` and
|
||||
all interface fields (except for ``network`` and ``storage`` which
|
||||
have always been dynamic, even for nodes with a classic driver).
|
||||
:returns: a tuple with two items:
|
||||
|
||||
* new driver field - the target hardware type
|
||||
* dictionary containing interfaces to update, e.g.
|
||||
{'deploy': 'iscsi', 'power': 'ipmitool'}
|
||||
"""
|
||||
|
||||
For example, for the ``agent_ipmitool`` driver:
|
||||
@ -152,42 +152,62 @@ Queens release automatically update nodes.
|
||||
.. code-block:: python
|
||||
|
||||
@classmethod
|
||||
def to_hardware_type(cls, node):
|
||||
def to_hardware_type(cls):
|
||||
if CONF.inspector.enabled:
|
||||
inspect_interface = 'inspector'
|
||||
else:
|
||||
inspect_interface = 'no-inspect'
|
||||
|
||||
return {'driver': 'ipmi',
|
||||
'boot_interface': 'pxe',
|
||||
'console_interface': 'no-console',
|
||||
'deploy_interface': 'direct',
|
||||
'inspect_interface': inspect_interface,
|
||||
'management_interface': 'ipmitool',
|
||||
'power_interface': 'ipmitool',
|
||||
'raid_interface': 'agent',
|
||||
'vendor_interface': 'no-vendor'}
|
||||
return 'ipmi', {'boot': 'pxe',
|
||||
'deploy': 'direct',
|
||||
'inspect': inspect_interface,
|
||||
'management': 'ipmitool',
|
||||
'power': 'ipmitool',
|
||||
'raid': 'agent'}
|
||||
|
||||
* Update the ``online_data_migration`` command with a new migration:
|
||||
* Update the ``online_data_migrations`` to accept options for migrations in
|
||||
the form of ``--option <MIGRATION NAME><KEY>=<VALUE>``. They will be passed
|
||||
as keyword arguments to the migration matching the provided name.
|
||||
|
||||
* Update the ``online_data_migrations`` command with a new migration
|
||||
``migrate_to_harware_types``. It will accept one option
|
||||
``reset_unsupported_interfaces``, which is a boolean value with the default
|
||||
of ``False``. The migration will do the following:
|
||||
|
||||
#. Load classes for all classic drivers in the ``ironic.drivers`` entrypoint
|
||||
(but do not instantiate them).
|
||||
|
||||
#. For each node using a classic driver:
|
||||
#. For each classic driver:
|
||||
|
||||
#. Calculate required changes using ``DriverClass.to_hardware_type``.
|
||||
|
||||
#. If the hardware type or any interface is not in the enabled list
|
||||
(``enabled_hardware_types`` or ``enabled_***_interfaces``), issue
|
||||
a warning and skip the node.
|
||||
Missing interfaces, other than ``boot``, ``deploy``, ``management``
|
||||
and ``power``, are defaulted to their no-op implementations
|
||||
(``no-***``).
|
||||
|
||||
.. note::
|
||||
Due to idempotency of the migrations, operators will be able to
|
||||
re-run this command after fixing the warnings to update the
|
||||
skipped nodes.
|
||||
We consider ``boot``, ``deploy``, ``management`` and ``power``
|
||||
mandatory, as they do not have a no-op implementation.
|
||||
|
||||
#. If the hardware type is not in ``enabled_hardware_types``, issue a
|
||||
and skip all nodes with this classic driver.
|
||||
|
||||
#. If any interface is not enabled (not in ``enabled_***_interfaces``):
|
||||
|
||||
#. if this interface is one of ``boot``, ``deploy``, ``management``
|
||||
or ``power``, or if ``reset_unsupported_interfaces`` is ``False``,
|
||||
issue a warning and skip the nodes.
|
||||
|
||||
#. otherwise try again with resetting the interface to its no-op
|
||||
implementation (``no-***``).
|
||||
|
||||
#. Update the node record in the database.
|
||||
|
||||
.. note::
|
||||
Due to idempotency of the migrations, operators will be able to
|
||||
re-run this command after fixing the warnings to update the
|
||||
skipped nodes.
|
||||
|
||||
* In the **Rocky** cycle, update the ``dbsync`` command with a check that no
|
||||
nodes are using classic drivers. As the list of classic drivers will not be
|
||||
available at that time (they will be removed from the tree), maintain the
|
||||
|
Loading…
Reference in New Issue
Block a user