root/include/pcmki/pcmki_scheduler.h

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

INCLUDED FROM


DEFINITIONS

This source file includes following definitions.
  1. pcmk__colocation_has_influence

   1 /*
   2  * Copyright 2014-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_SCHEDULER__H
  11 #  define PCMK__PCMKI_PCMKI_SCHEDULER__H
  12 
  13 typedef struct rsc_ticket_s rsc_ticket_t;
  14 
  15 #  include <glib.h>
  16 #  include <crm/crm.h>
  17 #  include <crm/common/iso8601.h>
  18 #  include <crm/pengine/rules.h>
  19 #  include <crm/pengine/common.h>
  20 #  include <crm/pengine/status.h>
  21 
  22 #  include <crm/pengine/complex.h>
  23 
  24 enum pe_weights {
  25     pe_weights_none = 0x0,
  26     pe_weights_init = 0x1,
  27     pe_weights_forward = 0x4,
  28     pe_weights_positive = 0x8,
  29     pe_weights_rollback = 0x10,
  30 };
  31 
  32 typedef struct {
  33     const char *id;
  34     const char *node_attribute;
  35     pe_resource_t *dependent;   // The resource being colocated
  36     pe_resource_t *primary;     // The resource the dependent is colocated with
  37 
  38     int dependent_role; // Colocation applies only if dependent has this role
  39     int primary_role;   // Colocation applies only if primary has this role
  40 
  41     int score;
  42     bool influence; // Whether dependent influences active primary placement
  43 } pcmk__colocation_t;
  44 
  45 enum loss_ticket_policy_e {
  46     loss_ticket_stop,
  47     loss_ticket_demote,
  48     loss_ticket_fence,
  49     loss_ticket_freeze
  50 };
  51 
  52 struct rsc_ticket_s {
  53     const char *id;
  54     pe_resource_t *rsc_lh;
  55     pe_ticket_t *ticket;
  56     enum loss_ticket_policy_e loss_policy;
  57 
  58     int role_lh;
  59 };
  60 
  61 void pcmk__unpack_constraints(pe_working_set_t *data_set);
  62 
  63 extern void add_maintenance_update(pe_working_set_t *data_set);
  64 void pcmk__schedule_actions(xmlNode *cib, unsigned long long flags,
  65                             pe_working_set_t *data_set);
  66 
  67 extern const char *transition_idle_timeout;
  68 
  69 /*!
  70  * \internal
  71  * \brief Check whether colocation's left-hand preferences should be considered
  72  *
  73  * \param[in] colocation  Colocation constraint
  74  * \param[in] rsc         Right-hand instance (normally this will be
  75  *                        colocation->primary, which NULL will be treated as,
  76  *                        but for clones or bundles with multiple instances
  77  *                        this can be a particular instance)
  78  *
  79  * \return true if colocation influence should be effective, otherwise false
  80  */
  81 static inline bool
  82 pcmk__colocation_has_influence(const pcmk__colocation_t *colocation,
     /* [previous][next][first][last][top][bottom][index][help] */
  83                                const pe_resource_t *rsc)
  84 {
  85     if (rsc == NULL) {
  86         rsc = colocation->primary;
  87     }
  88 
  89     /* The left hand of a colocation influences the right hand's location
  90      * if the influence option is true, or the right hand is not yet active.
  91      */
  92     return colocation->influence || (rsc->running_on == NULL);
  93 }
  94 
  95 #endif

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