Esempio n. 1
0
    def execute_process_failure(self, context, process_name, host_name,
                                notification_uuid):
        novaclient = nova.API()
        # get flow for process failure
        process_what = {
            'context': context,
            'process_name': process_name,
            'host_name': host_name
        }

        # TODO(abhishekk) We need to create a map for process_name and
        # respective python-client so that we can pass appropriate client
        # as a input to the process.
        if process_name == "nova-compute":
            recovery_flow = process_failure.get_compute_process_recovery_flow
        else:
            LOG.warning("Skipping recovery for process: %s.",
                        process_name)
            raise exception.SkipProcessRecoveryException()

        try:
            flow_engine = recovery_flow(novaclient, process_what)
        except Exception:
            msg = (_('Failed to create process failure flow.'),
                   notification_uuid)
            LOG.exception(msg)
            raise exception.MasakariException(msg)

        # Attaching this listener will capture all of the notifications that
        # taskflow sends out and redirect them to a more useful log for
        # masakari's debugging (or error reporting) usage.
        with base.DynamicLogListener(flow_engine, logger=LOG):
            flow_engine.run()
Esempio n. 2
0
    def _execute_auto_workflow(self, novaclient, process_what):
        flow_engine = host_failure.get_auto_flow(novaclient, process_what)

        # Attaching this listener will capture all of the notifications
        # that taskflow sends out and redirect them to a more useful
        # log for masakari's debugging (or error reporting) usage.
        with base.DynamicLogListener(flow_engine, logger=LOG):
            flow_engine.run()
Esempio n. 3
0
    def _execute_rh_workflow(self, novaclient, process_what,
                             reserved_host_list):
        if not reserved_host_list:
            msg = _('No reserved_hosts available for evacuation.')
            LOG.info(msg)
            raise exception.ReservedHostsUnavailable(message=msg)

        process_what['reserved_host_list'] = reserved_host_list
        flow_engine = host_failure.get_rh_flow(novaclient, process_what)

        with base.DynamicLogListener(flow_engine, logger=LOG):
            try:
                flow_engine.run()
            except exception.LockAlreadyAcquired as ex:
                raise exception.HostRecoveryFailureException(ex.message)
Esempio n. 4
0
    def execute_instance_failure(self, context, instance_uuid,
                                 notification_uuid):
        novaclient = nova.API()
        # get flow for instance failure
        process_what = {
            'context': context,
            'instance_uuid': instance_uuid
        }

        try:
            flow_engine = instance_failure.get_instance_recovery_flow(
                novaclient, process_what)
        except Exception:
            msg = (_('Failed to create instance failure flow.'),
                   notification_uuid)
            LOG.exception(msg)
            raise exception.MasakariException(msg)

        # Attaching this listener will capture all of the notifications that
        # taskflow sends out and redirect them to a more useful log for
        # masakari's debugging (or error reporting) usage.
        with base.DynamicLogListener(flow_engine, logger=LOG):
            flow_engine.run()