Esempio n. 1
0
def get_instance_recovery_flow(novaclient, process_what):
    """Constructs and returns the engine entrypoint flow.

    This flow will do the following:

    1. Stop the instance
    2. Start the instance.
    3. Confirm instance is in active state.
    """

    flow_name = ACTION.replace(":", "_") + "_engine"
    nested_flow = linear_flow.Flow(flow_name)

    task_dict = TASKFLOW_CONF.instance_failure_recovery_tasks

    instance_recovery_workflow_pre = linear_flow.Flow('pre_tasks')
    for plugin in base.get_recovery_flow(task_dict['pre'],
                                         novaclient=novaclient):
        instance_recovery_workflow_pre.add(plugin)

    instance_recovery_workflow_main = linear_flow.Flow('main_tasks')
    for plugin in base.get_recovery_flow(task_dict['main'],
                                         novaclient=novaclient):
        instance_recovery_workflow_main.add(plugin)

    instance_recovery_workflow_post = linear_flow.Flow('post_tasks')
    for plugin in base.get_recovery_flow(task_dict['post'],
                                         novaclient=novaclient):
        instance_recovery_workflow_post.add(plugin)

    nested_flow.add(instance_recovery_workflow_pre)
    nested_flow.add(instance_recovery_workflow_main)
    nested_flow.add(instance_recovery_workflow_post)

    return taskflow.engines.load(nested_flow, store=process_what)
Esempio n. 2
0
def get_compute_process_recovery_flow(context, novaclient, process_what):
    """Constructs and returns the engine entrypoint flow.

    This flow will do the following:

    1. Disable nova-compute process
    2. Confirm nova-compute process is disabled
    """

    flow_name = ACTION.replace(":", "_") + "_engine"
    nested_flow = linear_flow.Flow(flow_name)

    task_dict = TASKFLOW_CONF.process_failure_recovery_tasks

    process_recovery_workflow_pre = linear_flow.Flow('pre_tasks')
    for plugin in base.get_recovery_flow(task_dict['pre'], context=context,
                                         novaclient=novaclient):
        process_recovery_workflow_pre.add(plugin)

    process_recovery_workflow_main = linear_flow.Flow('main_tasks')
    for plugin in base.get_recovery_flow(task_dict['main'], context=context,
                                         novaclient=novaclient):
        process_recovery_workflow_main.add(plugin)

    process_recovery_workflow_post = linear_flow.Flow('post_tasks')
    for plugin in base.get_recovery_flow(task_dict['post'], context=context,
                                         novaclient=novaclient):
        process_recovery_workflow_post.add(plugin)

    nested_flow.add(process_recovery_workflow_pre)
    nested_flow.add(process_recovery_workflow_main)
    nested_flow.add(process_recovery_workflow_post)

    return base.load_taskflow_into_engine(ACTION, nested_flow,
                                          process_what)
Esempio n. 3
0
def get_compute_process_recovery_flow(novaclient, process_what):
    """Constructs and returns the engine entrypoint flow.

    This flow will do the following:

    1. Disable nova-compute process
    2. Confirm nova-compute process is disabled
    """

    flow_name = ACTION.replace(":", "_") + "_engine"
    nested_flow = linear_flow.Flow(flow_name)

    task_dict = TASKFLOW_CONF.process_failure_recovery_tasks

    process_recovery_workflow_pre = linear_flow.Flow('pre_tasks')
    for plugin in base.get_recovery_flow(task_dict['pre'],
                                         novaclient=novaclient):
        process_recovery_workflow_pre.add(plugin)

    process_recovery_workflow_main = linear_flow.Flow('main_tasks')
    for plugin in base.get_recovery_flow(task_dict['main'],
                                         novaclient=novaclient):
        process_recovery_workflow_main.add(plugin)

    process_recovery_workflow_post = linear_flow.Flow('post_tasks')
    for plugin in base.get_recovery_flow(task_dict['post'],
                                         novaclient=novaclient):
        process_recovery_workflow_post.add(plugin)

    nested_flow.add(process_recovery_workflow_pre)
    nested_flow.add(process_recovery_workflow_main)
    nested_flow.add(process_recovery_workflow_post)

    return taskflow.engines.load(nested_flow, store=process_what)
Esempio n. 4
0
def get_rh_flow(context, novaclient, process_what, **kwargs):
    """Constructs and returns the engine entrypoint flow.

    This flow will do the following:

    1. Disable compute service on source host
    2. Get all HA_Enabled instances.
    3. Evacuate all the HA_Enabled instances using reserved_host.
    4. Confirm evacuation of instances.
    """
    flow_name = ACTION.replace(":", "_") + "_engine"
    nested_flow = linear_flow.Flow(flow_name)

    task_dict = TASKFLOW_CONF.host_rh_failure_recovery_tasks

    rh_evacuate_flow_pre = linear_flow.Flow('pre_tasks')
    for plugin in base.get_recovery_flow(task_dict['pre'],
                                         context=context,
                                         novaclient=novaclient,
                                         **kwargs):
        rh_evacuate_flow_pre.add(plugin)

    rh_evacuate_flow_main = linear_flow.Flow("retry_%s" % flow_name,
                                             retry=retry.ParameterizedForEach(
                                                 rebind=['reserved_host_list'],
                                                 provides='reserved_host'))

    for plugin in base.get_recovery_flow(task_dict['main'],
                                         context=context,
                                         novaclient=novaclient,
                                         **kwargs):
        rh_evacuate_flow_main.add(plugin)

    rh_evacuate_flow_post = linear_flow.Flow('post_tasks')
    for plugin in base.get_recovery_flow(task_dict['post'],
                                         context=context,
                                         novaclient=novaclient,
                                         **kwargs):
        rh_evacuate_flow_post.add(plugin)

    nested_flow.add(rh_evacuate_flow_pre)
    nested_flow.add(rh_evacuate_flow_main)
    nested_flow.add(rh_evacuate_flow_post)

    return base.load_taskflow_into_engine(ACTION, nested_flow, process_what)
Esempio n. 5
0
def get_auto_flow(context, novaclient, process_what):
    """Constructs and returns the engine entrypoint flow.

    This flow will do the following:

    1. Disable compute service on source host
    2. Get all HA_Enabled instances.
    3. Evacuate all the HA_Enabled instances.
    4. Confirm evacuation of instances.
    """

    flow_name = ACTION.replace(":", "_") + "_engine"
    nested_flow = linear_flow.Flow(flow_name)

    task_dict = TASKFLOW_CONF.host_auto_failure_recovery_tasks

    auto_evacuate_flow_pre = linear_flow.Flow('pre_tasks')
    for plugin in base.get_recovery_flow(task_dict['pre'],
                                         context=context,
                                         novaclient=novaclient,
                                         update_host_method=None):
        auto_evacuate_flow_pre.add(plugin)

    auto_evacuate_flow_main = linear_flow.Flow('main_tasks')
    for plugin in base.get_recovery_flow(task_dict['main'],
                                         context=context,
                                         novaclient=novaclient,
                                         update_host_method=None):
        auto_evacuate_flow_main.add(plugin)

    auto_evacuate_flow_post = linear_flow.Flow('post_tasks')
    for plugin in base.get_recovery_flow(task_dict['post'],
                                         context=context,
                                         novaclient=novaclient,
                                         update_host_method=None):
        auto_evacuate_flow_post.add(plugin)

    nested_flow.add(auto_evacuate_flow_pre)
    nested_flow.add(auto_evacuate_flow_main)
    nested_flow.add(auto_evacuate_flow_post)

    return base.load_taskflow_into_engine(ACTION, nested_flow, process_what)
Esempio n. 6
0
    def _get_taskflow_sequence(self, context, recovery_method, notification):
        # Get the taskflow sequence based on the recovery method.

        novaclient = nova.API()
        task_list = []

        # Get linear task flow based on notification type
        if notification.type == fields.NotificationType.VM:
            tasks = TASKFLOW_CONF.instance_failure_recovery_tasks
        elif notification.type == fields.NotificationType.PROCESS:
            tasks = TASKFLOW_CONF.process_failure_recovery_tasks
        elif notification.type == fields.NotificationType.COMPUTE_HOST:
            if recovery_method in [
                    fields.FailoverSegmentRecoveryMethod.AUTO,
                    fields.FailoverSegmentRecoveryMethod.AUTO_PRIORITY
            ]:
                tasks = TASKFLOW_CONF.host_auto_failure_recovery_tasks
            elif recovery_method in [
                    fields.FailoverSegmentRecoveryMethod.RESERVED_HOST,
                    fields.FailoverSegmentRecoveryMethod.RH_PRIORITY
            ]:
                tasks = TASKFLOW_CONF.host_rh_failure_recovery_tasks

        for plugin in base.get_recovery_flow(tasks['pre'],
                                             context=context,
                                             novaclient=novaclient,
                                             update_host_method=None):
            task_list.append(plugin.name)

        for plugin in base.get_recovery_flow(tasks['main'],
                                             context=context,
                                             novaclient=novaclient,
                                             update_host_method=None):
            task_list.append(plugin.name)

        for plugin in base.get_recovery_flow(tasks['post'],
                                             context=context,
                                             novaclient=novaclient,
                                             update_host_method=None):
            task_list.append(plugin.name)

        return task_list
Esempio n. 7
0
def get_rh_flow(context, novaclient, process_what, **kwargs):
    """Constructs and returns the engine entrypoint flow.

    This flow will do the following:

    1. Disable compute service on source host
    2. Get all HA_Enabled instances.
    3. Evacuate all the HA_Enabled instances using reserved_host.
    4. Confirm evacuation of instances.
    """
    flow_name = ACTION.replace(":", "_") + "_engine"
    nested_flow = linear_flow.Flow(flow_name)

    task_dict = TASKFLOW_CONF.host_rh_failure_recovery_tasks

    rh_evacuate_flow_pre = linear_flow.Flow('pre_tasks')
    for plugin in base.get_recovery_flow(
            task_dict['pre'],
            context=context, novaclient=novaclient, **kwargs):
        rh_evacuate_flow_pre.add(plugin)

    rh_evacuate_flow_main = linear_flow.Flow(
        "retry_%s" % flow_name, retry=retry.ParameterizedForEach(
            rebind=['reserved_host_list'], provides='reserved_host'))

    for plugin in base.get_recovery_flow(
            task_dict['main'],
            context=context, novaclient=novaclient, **kwargs):
        rh_evacuate_flow_main.add(plugin)

    rh_evacuate_flow_post = linear_flow.Flow('post_tasks')
    for plugin in base.get_recovery_flow(
            task_dict['post'],
            context=context, novaclient=novaclient, **kwargs):
        rh_evacuate_flow_post.add(plugin)

    nested_flow.add(rh_evacuate_flow_pre)
    nested_flow.add(rh_evacuate_flow_main)
    nested_flow.add(rh_evacuate_flow_post)

    return base.load_taskflow_into_engine(ACTION, nested_flow,
                                          process_what)
Esempio n. 8
0
def get_auto_flow(context, novaclient, process_what):
    """Constructs and returns the engine entrypoint flow.

    This flow will do the following:

    1. Disable compute service on source host
    2. Get all HA_Enabled instances.
    3. Evacuate all the HA_Enabled instances.
    4. Confirm evacuation of instances.
    """

    flow_name = ACTION.replace(":", "_") + "_engine"
    nested_flow = linear_flow.Flow(flow_name)

    task_dict = TASKFLOW_CONF.host_auto_failure_recovery_tasks

    auto_evacuate_flow_pre = linear_flow.Flow('pre_tasks')
    for plugin in base.get_recovery_flow(task_dict['pre'], context=context,
                                         novaclient=novaclient,
                                         update_host_method=None):
        auto_evacuate_flow_pre.add(plugin)

    auto_evacuate_flow_main = linear_flow.Flow('main_tasks')
    for plugin in base.get_recovery_flow(task_dict['main'], context=context,
                                         novaclient=novaclient,
                                         update_host_method=None):
        auto_evacuate_flow_main.add(plugin)

    auto_evacuate_flow_post = linear_flow.Flow('post_tasks')
    for plugin in base.get_recovery_flow(task_dict['post'], context=context,
                                         novaclient=novaclient,
                                         update_host_method=None):
        auto_evacuate_flow_post.add(plugin)

    nested_flow.add(auto_evacuate_flow_pre)
    nested_flow.add(auto_evacuate_flow_main)
    nested_flow.add(auto_evacuate_flow_post)

    return base.load_taskflow_into_engine(ACTION, nested_flow,
                                          process_what)
Esempio n. 9
0
    def _get_taskflow_sequence(self, context, recovery_method, notification):
        # Get the taskflow sequence based on the recovery method.

        novaclient = nova.API()
        task_list = []

        # Get linear task flow based on notification type
        if notification.type == fields.NotificationType.VM:
            tasks = TASKFLOW_CONF.instance_failure_recovery_tasks
        elif notification.type == fields.NotificationType.PROCESS:
            tasks = TASKFLOW_CONF.process_failure_recovery_tasks
        elif notification.type == fields.NotificationType.COMPUTE_HOST:
            if recovery_method in [
                    fields.FailoverSegmentRecoveryMethod.AUTO,
                    fields.FailoverSegmentRecoveryMethod.AUTO_PRIORITY]:
                tasks = TASKFLOW_CONF.host_auto_failure_recovery_tasks
            elif recovery_method in [
                    fields.FailoverSegmentRecoveryMethod.RESERVED_HOST,
                    fields.FailoverSegmentRecoveryMethod.RH_PRIORITY]:
                tasks = TASKFLOW_CONF.host_rh_failure_recovery_tasks

        for plugin in base.get_recovery_flow(
                tasks['pre'], context=context, novaclient=novaclient,
                update_host_method=None):
            task_list.append(plugin.name)

        for plugin in base.get_recovery_flow(
                tasks['main'], context=context, novaclient=novaclient,
                update_host_method=None):
            task_list.append(plugin.name)

        for plugin in base.get_recovery_flow(
                tasks['post'], context=context, novaclient=novaclient,
                update_host_method=None):
            task_list.append(plugin.name)

        return task_list
Esempio n. 10
0
def get_instance_recovery_flow(context, novaclient, process_what):
    """Constructs and returns the engine entrypoint flow.

    This flow will do the following:

    1. Stop the instance
    2. Start the instance.
    3. Confirm instance is in active state.
    """

    flow_name = ACTION.replace(":", "_") + "_engine"
    nested_flow = linear_flow.Flow(flow_name)

    task_dict = TASKFLOW_CONF.instance_failure_recovery_tasks

    instance_recovery_workflow_pre = linear_flow.Flow('pre_tasks')
    for plugin in base.get_recovery_flow(task_dict['pre'], context=context,
                                         novaclient=novaclient):
        instance_recovery_workflow_pre.add(plugin)

    instance_recovery_workflow_main = linear_flow.Flow('main_tasks')
    for plugin in base.get_recovery_flow(task_dict['main'], context=context,
                                         novaclient=novaclient):
        instance_recovery_workflow_main.add(plugin)

    instance_recovery_workflow_post = linear_flow.Flow('post_tasks')
    for plugin in base.get_recovery_flow(task_dict['post'], context=context,
                                         novaclient=novaclient):
        instance_recovery_workflow_post.add(plugin)

    nested_flow.add(instance_recovery_workflow_pre)
    nested_flow.add(instance_recovery_workflow_main)
    nested_flow.add(instance_recovery_workflow_post)

    return base.load_taskflow_into_engine(ACTION, nested_flow,
                                          process_what)