root/include/pcmki/pcmki_simulate.h

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

INCLUDED FROM


   1 /*
   2  * Copyright 2021 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 PCMKI_SIMULATE__H
  11 #  define PCMKI_SIMULATE__H
  12 
  13 #include <crm/common/output_internal.h>
  14 #include <crm/pengine/pe_types.h>
  15 #include <pacemaker.h>
  16 #include <stdbool.h>
  17 
  18 /**
  19  * \brief Write out a file in dot(1) format describing the actions that will
  20  *        be taken by the scheduler in response to an input CIB file.
  21  *
  22  * \param[in] data_set    Working set for the cluster.
  23  * \param[in] dot_file    The filename to write.
  24  * \param[in] all_actions Write all actions, even those that are optional or
  25  *                        are on unmanaged resources.
  26  * \param[in] verbose     Add extra information, such as action IDs, to the
  27  *                        output.
  28  *
  29  * \return Standard Pacemaker return code
  30  */
  31 int pcmk__write_sim_dotfile(pe_working_set_t *data_set, const char *dot_file,
  32                             bool all_actions, bool verbose);
  33 
  34 /**
  35  * \brief Profile the configuration updates and scheduler actions in a single
  36  *        CIB file, printing the profiling timings.
  37  *
  38  * \note \p data_set->priv must have been set to a valid \p pcmk__output_t
  39  *       object before this function is called.
  40  *
  41  * \param[in] xml_file The CIB file to profile.
  42  * \param[in] repeat   Number of times to run.
  43  * \param[in] data_set Working set for the cluster.
  44  * \param[in] use_date The date to set the cluster's time to (may
  45  *                     be NULL).
  46  */
  47 void pcmk__profile_file(const char *xml_file, long long repeat, pe_working_set_t *data_set,
  48                         char *use_date);
  49 
  50 /**
  51  * \brief Profile the configuration updates and scheduler actions in every
  52  *        CIB file in a given directory, printing the profiling timings for
  53  *        each.
  54  *
  55  * \note \p data_set->priv must have been set to a valid \p pcmk__output_t
  56  *       object before this function is called.
  57  *
  58  * \param[in] dir      A directory full of CIB files to be profiled.
  59  * \param[in] repeat   Number of times to run on each input file.
  60  * \param[in] data_set Working set for the cluster.
  61  * \param[in] use_date The date to set the cluster's time to (may
  62  *                     be NULL).
  63  */
  64 void pcmk__profile_dir(const char *dir, long long repeat, pe_working_set_t *data_set,
  65                        char *use_date);
  66 
  67 /**
  68  * \brief Set the date of the cluster, either to the value given by
  69  *        \p use_date, or to the "execution-date" value in the CIB.
  70  *
  71  * \note \p data_set->priv must have been set to a valid \p pcmk__output_t
  72  *       object before this function is called.
  73  *
  74  * \param[in,out] data_set       Working set for the cluster.
  75  * \param[in]     print_original If \p true, the "execution-date" should
  76  *                               also be printed.
  77  * \param[in]     use_date       The date to set the cluster's time to
  78  *                               (may be NULL).
  79  */
  80 void pcmk__set_effective_date(pe_working_set_t *data_set, bool print_original, char *use_date);
  81 
  82 /**
  83  * \brief Simulate a cluster's response to events.
  84  *
  85  * This high-level function essentially implements crm_simulate(8).  It operates
  86  * on an input CIB file and various lists of events that can be simulated.  It
  87  * optionally writes out a variety of artifacts to show the results of the
  88  * simulation.  Output can be modified with various flags.
  89  *
  90  * \param[in,out] data_set     Working set for the cluster.
  91  * \param[in,out] out          The output functions structure.
  92  * \param[in]     events       A structure containing cluster events
  93  *                             (node up/down, tickets, injected operations)
  94  *                             and related data.
  95  * \param[in]     flags        A bitfield of :pcmk_sim_flags to modify
  96  *                             operation of the simulation.
  97  * \param[in]     section_opts Which portions of the cluster status output
  98  *                             should be displayed?
  99  * \param[in]     use_date     The date to set the cluster's time to
 100  *                             (may be NULL).
 101  * \param[in]     input_file   The source CIB file, which may be overwritten by
 102  *                             this function (may be NULL).
 103  * \param[in]     graph_file   Where to write the XML-formatted transition graph
 104  *                             (may be NULL, in which case no file will be
 105  *                             written).
 106  * \param[in]     dot_file     Where to write the dot(1) formatted transition
 107  *                             graph (may be NULL, in which case no file will
 108  *                             be written).  See \p pcmk__write_sim_dotfile().
 109  *
 110  * \return Standard Pacemaker return code
 111  */
 112 int pcmk__simulate(pe_working_set_t *data_set, pcmk__output_t *out,
 113                    pcmk_injections_t *injections, unsigned int flags,
 114                    unsigned int section_opts, char *use_date, char *input_file,
 115                    char *graph_file, char *dot_file);
 116 
 117 #endif

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