root/include/pcmki/pcmki_simulate.h

/* [previous][next][first][last][top][bottom][index][help] */

INCLUDED FROM


   1 /*
   2  * Copyright 2021-2022 the Pacemaker project contributors
   3  *
   4  * The version control history for this file may have further details.
   5  *
   6  * This source code is licensed under the GNU Lesser General Public License
   7  * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY.
   8  */
   9 
  10 #ifndef PCMK__PCMKI_PCMKI_SIMULATE__H
  11 #  define PCMK__PCMKI_PCMKI_SIMULATE__H
  12 
  13 #include <crm/common/output_internal.h>
  14 #include <crm/pengine/pe_types.h>
  15 #include <pcmki/pcmki_transition.h>
  16 #include <crm/cib.h>                    // cib_t
  17 #include <pacemaker.h>
  18 #include <stdbool.h>
  19 #include <stdint.h>
  20 
  21 /**
  22  * \internal
  23  * \brief Profile the configuration updates and scheduler actions in every
  24  *        CIB file in a given directory, printing the profiling timings for
  25  *        each.
  26  *
  27  * \note \p data_set->priv must have been set to a valid \p pcmk__output_t
  28  *       object before this function is called.
  29  *
  30  * \param[in] dir      A directory full of CIB files to be profiled.
  31  * \param[in] repeat   Number of times to run on each input file.
  32  * \param[in] data_set Working set for the cluster.
  33  * \param[in] use_date The date to set the cluster's time to (may
  34  *                     be NULL).
  35  */
  36 void pcmk__profile_dir(const char *dir, long long repeat, pe_working_set_t *data_set,
  37                        char *use_date);
  38 
  39 /**
  40  * \internal
  41  * \brief Simulate executing a transition
  42  *
  43  * \param[in] data_set      Cluster working set
  44  * \param[in] cib           CIB object for scheduler input
  45  * \param[in] op_fail_list  List of actions to simulate as failing
  46  *
  47  * \return Transition status after simulated execution
  48  */
  49 enum pcmk__graph_status pcmk__simulate_transition(pe_working_set_t *data_set,
  50                                                   cib_t *cib,
  51                                                   GList *op_fail_list);
  52 
  53 /**
  54  * \internal
  55  * \brief Simulate a cluster's response to events.
  56  *
  57  * This high-level function essentially implements crm_simulate(8).  It operates
  58  * on an input CIB file and various lists of events that can be simulated.  It
  59  * optionally writes out a variety of artifacts to show the results of the
  60  * simulation.  Output can be modified with various flags.
  61  *
  62  * \param[in,out] data_set     Working set for the cluster.
  63  * \param[in,out] out          The output functions structure.
  64  * \param[in]     events       A structure containing cluster events
  65  *                             (node up/down, tickets, injected operations)
  66  *                             and related data.
  67  * \param[in]     flags        A bitfield of :pcmk_sim_flags to modify
  68  *                             operation of the simulation.
  69  * \param[in]     section_opts Which portions of the cluster status output
  70  *                             should be displayed?
  71  * \param[in]     use_date     The date to set the cluster's time to
  72  *                             (may be NULL).
  73  * \param[in]     input_file   The source CIB file, which may be overwritten by
  74  *                             this function (may be NULL).
  75  * \param[in]     graph_file   Where to write the XML-formatted transition graph
  76  *                             (may be NULL, in which case no file will be
  77  *                             written).
  78  * \param[in]     dot_file     Where to write the dot(1) formatted transition
  79  *                             graph (may be NULL, in which case no file will
  80  *                             be written).  See \p pcmk__write_sim_dotfile().
  81  *
  82  * \return Standard Pacemaker return code
  83  */
  84 int pcmk__simulate(pe_working_set_t *data_set, pcmk__output_t *out,
  85                    pcmk_injections_t *injections, unsigned int flags,
  86                    uint32_t section_opts, char *use_date, char *input_file,
  87                    char *graph_file, char *dot_file);
  88 
  89 /*!
  90  * \internal
  91  *
  92  * If this global is set to true, simulations will add nodes to the
  93  * CIB configuration section, as well as the status section.
  94  */
  95 extern bool pcmk__simulate_node_config;
  96 
  97 #endif

/* [previous][next][first][last][top][bottom][index][help] */