e85a36fe36
This change adds a new deploy-interface custom-agent that is essentially the direct deploy without the write_image step and without bootloader handling. It's targeted at deployments that need to write the image differently, while keeping all other aspects the same. The existing AgentDeploy becomes a subclass of the new CustomAgentDeploy class, serving as a convenient base class for downstream deploy interfaces that use IPA. Change-Id: Ie126ce677c79f102e382305650bddb7f09834483 Story: #2008719 Task: #42059
91 lines
2.5 KiB
ReStructuredText
91 lines
2.5 KiB
ReStructuredText
Developing a new Deploy Step
|
|
============================
|
|
|
|
To support customized deployment step, implement a new method in an interface
|
|
class and use the decorator ``deploy_step`` defined in
|
|
``ironic/drivers/base.py``. For example, we will implement a ``do_nothing``
|
|
deploy step in the ``AgentDeploy`` class.
|
|
|
|
.. code-block:: python
|
|
|
|
from ironic.drivers.modules import agent
|
|
|
|
class AgentDeploy(agent.AgentDeploy):
|
|
|
|
@base.deploy_step(priority=200, argsinfo={
|
|
'test_arg': {
|
|
'description': (
|
|
"This is a test argument."
|
|
),
|
|
'required': True
|
|
}
|
|
})
|
|
def do_nothing(self, task, **kwargs):
|
|
return None
|
|
|
|
If you want to completely replace the deployment procedure, but still have the
|
|
agent up and running, inherit ``CustomAgentDeploy``:
|
|
|
|
.. code-block:: python
|
|
|
|
from ironic.drivers.modules import agent
|
|
|
|
class AgentDeploy(agent.CustomAgentDeploy):
|
|
|
|
def validate(self, task):
|
|
super().validate(task)
|
|
# ... custom validation
|
|
|
|
@base.deploy_step(priority=80)
|
|
def my_write_image(self, task, **kwargs):
|
|
pass # ... custom image writing
|
|
|
|
@base.deploy_step(priority=70)
|
|
def my_configure_bootloader(self, task, **kwargs):
|
|
pass # ... custom bootloader configuration
|
|
|
|
After deployment of the baremetal node, check the updated deploy steps::
|
|
|
|
baremetal node show $node_ident -f json -c driver_internal_info
|
|
|
|
The above command outputs the ``driver_internal_info`` as following::
|
|
|
|
{
|
|
"driver_internal_info": {
|
|
...
|
|
"deploy_steps": [
|
|
{
|
|
"priority": 200,
|
|
"interface": "deploy",
|
|
"step": "do_nothing",
|
|
"argsinfo":
|
|
{
|
|
"test_arg":
|
|
{
|
|
"required": True,
|
|
"description": "This is a test argument."
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"priority": 100,
|
|
"interface": "deploy",
|
|
"step": "deploy",
|
|
"argsinfo": null
|
|
}
|
|
],
|
|
"deploy_step_index": 1
|
|
}
|
|
}
|
|
|
|
.. note::
|
|
|
|
Similarly, clean steps can be implemented using the ``clean_step``
|
|
decorator.
|
|
|
|
In-band deploy steps (deploy steps that are run inside the ramdisk) have to be
|
|
implemented in a custom :ironic-python-agent-doc:`IPA hardware manager
|
|
<contributor/hardware_managers.html#custom-hardwaremanagers-and-deploying>`.
|
|
All in-band deploy steps must have priorities between 41 and 99, see
|
|
:ref:`node-deployment-core-steps` for details.
|