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

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