root/include/pcmki/pcmki_simulate.h

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

INCLUDED FROM


   1 /*
   2  * Copyright 2021-2024 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/common/scheduler.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 #ifdef __cplusplus
  22 extern "C" {
  23 #endif
  24 
  25 /*!
  26  * \internal
  27  * \brief Profile the configuration updates and scheduler actions in every
  28  *        CIB file in a given directory, printing the profiling timings for
  29  *        each.
  30  *
  31  * \note \p scheduler->priv->out must have been set to a valid \p pcmk__output_t
  32  *       object before this function is called.
  33  *
  34  * \param[in]     dir        A directory full of CIB files to be profiled
  35  * \param[in]     repeat     Number of times to run on each input file
  36  * \param[in,out] scheduler  Scheduler data
  37  * \param[in]     use_date   The date to set the cluster's time to (may be NULL)
  38  */
  39 void pcmk__profile_dir(const char *dir, long long repeat,
  40                        pcmk_scheduler_t *scheduler, const char *use_date);
  41 
  42 /*!
  43  * \internal
  44  * \brief Simulate executing a transition
  45  *
  46  * \param[in,out] scheduler     Scheduler data
  47  * \param[in,out] cib           CIB object for scheduler input
  48  * \param[in]     op_fail_list  List of actions to simulate as failing
  49  *
  50  * \return Transition status after simulated execution
  51  */
  52 enum pcmk__graph_status pcmk__simulate_transition(pcmk_scheduler_t *scheduler,
  53                                                   cib_t *cib,
  54                                                   const GList *op_fail_list);
  55 
  56 /*!
  57  * \internal
  58  * \brief Simulate a cluster's response to events
  59  *
  60  * This high-level function essentially implements crm_simulate(8).  It operates
  61  * on an input CIB file and various lists of events that can be simulated.  It
  62  * optionally writes out a variety of artifacts to show the results of the
  63  * simulation.  Output can be modified with various flags.
  64  *
  65  * \param[in,out] scheduler    Scheduler data
  66  * \param[in,out] out          The output functions structure
  67  * \param[in]     injections   A structure containing cluster events
  68  *                             (node up/down, tickets, injected operations)
  69  *                             and related data
  70  * \param[in]     flags        A bitfield of \p pcmk_sim_flags to modify
  71  *                             operation of the simulation
  72  * \param[in]     section_opts Which portions of the cluster status output
  73  *                             should be displayed?
  74  * \param[in]     use_date     The date to set the cluster's time to
  75  *                             (may be NULL)
  76  * \param[in]     input_file   The source CIB file, which may be overwritten by
  77  *                             this function (may be NULL)
  78  * \param[in]     graph_file   Where to write the XML-formatted transition graph
  79  *                             (may be NULL, in which case no file will be
  80  *                             written)
  81  * \param[in]     dot_file     Where to write the dot(1) formatted transition
  82  *                             graph (may be NULL, in which case no file will
  83  *                             be written; see \p pcmk__write_sim_dotfile())
  84  *
  85  * \return Standard Pacemaker return code
  86  */
  87 int pcmk__simulate(pcmk_scheduler_t *scheduler, pcmk__output_t *out,
  88                    const pcmk_injections_t *injections, unsigned int flags,
  89                    uint32_t section_opts, const char *use_date,
  90                    const char *input_file, const char *graph_file,
  91                    const char *dot_file);
  92 
  93 /*!
  94  * \internal
  95  *
  96  * If this global is set to true, simulations will add nodes to the
  97  * CIB configuration section, as well as the status section.
  98  */
  99 extern bool pcmk__simulate_node_config;
 100 
 101 #ifdef __cplusplus
 102 }
 103 #endif
 104 
 105 #endif // PCMK__PCMKI_PCMKI_SIMULATE__H

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