root/tools/crm_resource.h

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

INCLUDED FROM


   1 /*
   2  * Copyright 2004-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 #include <crm_internal.h>
  11 
  12 #include <stdint.h>
  13 #include <stdbool.h>
  14 
  15 #include <crm/crm.h>
  16 
  17 #include <crm/msg_xml.h>
  18 #include <crm/services.h>
  19 #include <crm/common/xml.h>
  20 #include <crm/common/mainloop.h>
  21 #include <crm/common/output_internal.h>
  22 
  23 #include <crm/cib.h>
  24 #include <crm/common/attrd_internal.h>
  25 #include <crm/pengine/rules.h>
  26 #include <crm/pengine/status.h>
  27 #include <crm/pengine/internal.h>
  28 #include <pacemaker-internal.h>
  29 
  30 typedef struct node_info_s {
  31     const char *node_name;
  32     bool promoted;
  33 } node_info_t;
  34 
  35 enum resource_check_flags {
  36     rsc_remain_stopped  = (1 << 0),
  37     rsc_unpromotable    = (1 << 1),
  38     rsc_unmanaged       = (1 << 2),
  39     rsc_locked          = (1 << 3),
  40     rsc_node_health     = (1 << 4),
  41 };
  42 
  43 typedef struct resource_checks_s {
  44     pe_resource_t *rsc;     // Resource being checked
  45     uint32_t flags;         // Group of enum resource_check_flags
  46     const char *lock_node;  // Node that resource is shutdown-locked to, if any
  47 } resource_checks_t;
  48 
  49 resource_checks_t *cli_check_resource(pe_resource_t *rsc, char *role_s, char *managed);
  50 
  51 /* ban */
  52 int cli_resource_prefer(pcmk__output_t *out, const char *rsc_id, const char *host,
  53                         const char *move_lifetime, cib_t * cib_conn, int cib_options,
  54                         gboolean promoted_role_only);
  55 int cli_resource_ban(pcmk__output_t *out, const char *rsc_id, const char *host,
  56                      const char *move_lifetime, GList *allnodes, cib_t * cib_conn,
  57                      int cib_options, gboolean promoted_role_only);
  58 int cli_resource_clear(const char *rsc_id, const char *host, GList *allnodes,
  59                        cib_t * cib_conn, int cib_options, bool clear_ban_constraints, gboolean force);
  60 int cli_resource_clear_all_expired(xmlNode *root, cib_t *cib_conn, int cib_options,
  61                                    const char *rsc, const char *node, gboolean promoted_role_only);
  62 
  63 /* print */
  64 void cli_resource_print_cts(pe_resource_t * rsc, pcmk__output_t *out);
  65 void cli_resource_print_cts_constraints(pe_working_set_t * data_set);
  66 
  67 int cli_resource_print(pe_resource_t *rsc, pe_working_set_t *data_set, bool expanded);
  68 int cli_resource_print_operations(const char *rsc_id, const char *host_uname,
  69                                   bool active, pe_working_set_t * data_set);
  70 
  71 /* runtime */
  72 int cli_resource_check(pcmk__output_t *out, pe_resource_t *rsc,
  73                        pe_node_t *node);
  74 int cli_resource_fail(pcmk_ipc_api_t *controld_api, const char *host_uname,
  75                       const char *rsc_id, pe_working_set_t *data_set);
  76 GList *cli_resource_search(pe_resource_t *rsc, const char *requested_name,
  77                              pe_working_set_t *data_set);
  78 int cli_resource_delete(pcmk_ipc_api_t *controld_api, const char *host_uname,
  79                         pe_resource_t *rsc, const char *operation,
  80                         const char *interval_spec, bool just_failures,
  81                         pe_working_set_t *data_set, gboolean force);
  82 int cli_cleanup_all(pcmk_ipc_api_t *controld_api, const char *node_name,
  83                     const char *operation, const char *interval_spec,
  84                     pe_working_set_t *data_set);
  85 int cli_resource_restart(pcmk__output_t *out, pe_resource_t *rsc, pe_node_t *node,
  86                          const char *move_lifetime, int timeout_ms, cib_t *cib,
  87                          int cib_options, gboolean promoted_role_only, gboolean force);
  88 int cli_resource_move(pe_resource_t *rsc, const char *rsc_id, const char *host_name,
  89                       const char *move_lifetime, cib_t *cib, int cib_options,
  90                       pe_working_set_t *data_set, gboolean promoted_role_only,
  91                       gboolean force);
  92 crm_exit_t cli_resource_execute_from_params(pcmk__output_t *out, const char *rsc_name,
  93                                             const char *rsc_class, const char *rsc_prov,
  94                                             const char *rsc_type, const char *rsc_action,
  95                                             GHashTable *params, GHashTable *override_hash,
  96                                             int timeout_ms, int resource_verbose,
  97                                             gboolean force, int check_level);
  98 crm_exit_t cli_resource_execute(pe_resource_t *rsc, const char *requested_name,
  99                                 const char *rsc_action, GHashTable *override_hash,
 100                                 int timeout_ms, cib_t *cib, pe_working_set_t *data_set,
 101                                 int resource_verbose, gboolean force, int check_level);
 102 
 103 int cli_resource_update_attribute(pe_resource_t *rsc, const char *requested_name,
 104                                   const char *attr_set, const char *attr_set_type,
 105                                   const char *attr_id, const char *attr_name,
 106                                   const char *attr_value, gboolean recursive,
 107                                   cib_t *cib, int cib_options,
 108                                   pe_working_set_t *data_set, gboolean force);
 109 int cli_resource_delete_attribute(pe_resource_t *rsc, const char *requested_name,
 110                                   const char *attr_set, const char *attr_set_type,
 111                                   const char *attr_id, const char *attr_name,
 112                                   cib_t *cib, int cib_options,
 113                                   pe_working_set_t *data_set, gboolean force);
 114 
 115 int update_working_set_xml(pe_working_set_t *data_set, xmlNode **xml);
 116 int wait_till_stable(pcmk__output_t *out, int timeout_ms, cib_t * cib);
 117 
 118 bool resource_is_running_on(pe_resource_t *rsc, const char *host);
 119 
 120 void crm_resource_register_messages(pcmk__output_t *out);

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