File: recovery_workflow_custom_task.rst

package info (click to toggle)
masakari 14.0.2-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 2,704 kB
  • sloc: python: 21,502; sh: 329; makefile: 66
file content (65 lines) | stat: -rw-r--r-- 2,506 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
================================================
Guide for Custom Recovery Workflow Configuration
================================================

If operator wants customized recovery workflow, so here is guidelines mentioned
for how to associate custom tasks from Third Party Library along with standard
recovery workflows in Masakari.:

#.  First make sure required Third Party Library is installed on the Masakari
    engine node. Below is the sample custom task file.
    For example:

.. code-block:: bash

    from oslo_log import log as logging
    from taskflow import task

    LOG = logging.getLogger(__name__)


    class Noop(task.Task):

        def __init__(self, novaclient):
            self.novaclient = novaclient
            super(Noop, self).__init__()

        def execute(self, **kwargs):
            LOG.info("Custom task executed successfully..!!")
            return

#.  Configure custom task in Third Party Library's setup.cfg as below:

For example, Third Party Library's setup.cfg will have following entry points

.. code-block:: bash

    masakari.task_flow.tasks =
        custom_pre_task = <custom_task_class_path_from_third_party_library>
        custom_main_task = <custom_task_class_path_from_third_party_library>
        custom_post_task = <custom_task_class_path_from_third_party_library>

Note: Entry point in Third Party Library's setup.cfg should have same key as
in Masakari setup.cfg for respective failure recovery.

#.  Configure custom task in Masakari's new conf file custom-recovery-methods.conf
    with same name which was given in the setup.cfg to locate class path.
    For example(custom task added in host auto failure config option):

.. code-block:: bash

        host_auto_failure_recovery_tasks = {
        'pre': ['disable_compute_service_task', 'custom_pre_task'],
        'main': ['custom_main_task', 'prepare_HA_enabled_instances_task'],
        'post': ['evacuate_instances_task', 'custom_post_task']}

#.  If there are any configuration parameters required for custom task,
    then add them into custom-recovery-methods.conf under the same
    group/section where they are registered in Third Party Library.
    All config parameters related to recovery method customization
    should be part of newly added conf file.
    Operator will be responsible to generate masakari.conf and related
    configuration files by themselves.

#.  Operator should ensure output of each task should be made available to
    the next tasks needing them.