1
2
3
4
5
6
7
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 #define ATTR_SET_ELEMENT "attr_set_element"
31
32 typedef struct node_info_s {
33 const char *node_name;
34 bool promoted;
35 } node_info_t;
36
37 enum resource_check_flags {
38 rsc_remain_stopped = (1 << 0),
39 rsc_unpromotable = (1 << 1),
40 rsc_unmanaged = (1 << 2),
41 rsc_locked = (1 << 3),
42 rsc_node_health = (1 << 4),
43 };
44
45 typedef struct resource_checks_s {
46 pe_resource_t *rsc;
47 uint32_t flags;
48 const char *lock_node;
49 } resource_checks_t;
50
51 resource_checks_t *cli_check_resource(pe_resource_t *rsc, char *role_s, char *managed);
52
53
54 int cli_resource_prefer(pcmk__output_t *out, const char *rsc_id, const char *host,
55 const char *move_lifetime, cib_t * cib_conn, int cib_options,
56 gboolean promoted_role_only);
57 int cli_resource_ban(pcmk__output_t *out, const char *rsc_id, const char *host,
58 const char *move_lifetime, GList *allnodes, cib_t * cib_conn,
59 int cib_options, gboolean promoted_role_only);
60 int cli_resource_clear(const char *rsc_id, const char *host, GList *allnodes,
61 cib_t * cib_conn, int cib_options, bool clear_ban_constraints, gboolean force);
62 int cli_resource_clear_all_expired(xmlNode *root, cib_t *cib_conn, int cib_options,
63 const char *rsc, const char *node, gboolean promoted_role_only);
64
65
66 void cli_resource_print_cts(pe_resource_t * rsc, pcmk__output_t *out);
67 void cli_resource_print_cts_constraints(pe_working_set_t * data_set);
68
69 int cli_resource_print(pe_resource_t *rsc, pe_working_set_t *data_set, bool expanded);
70 int cli_resource_print_operations(const char *rsc_id, const char *host_uname,
71 bool active, pe_working_set_t * data_set);
72
73
74 int cli_resource_check(pcmk__output_t *out, pe_resource_t *rsc,
75 pe_node_t *node);
76 int cli_resource_fail(pcmk_ipc_api_t *controld_api, const char *host_uname,
77 const char *rsc_id, pe_working_set_t *data_set);
78 GList *cli_resource_search(pe_resource_t *rsc, const char *requested_name,
79 pe_working_set_t *data_set);
80 int cli_resource_delete(pcmk_ipc_api_t *controld_api, const char *host_uname,
81 const pe_resource_t *rsc, const char *operation,
82 const char *interval_spec, bool just_failures,
83 pe_working_set_t *data_set, gboolean force);
84 int cli_cleanup_all(pcmk_ipc_api_t *controld_api, const char *node_name,
85 const char *operation, const char *interval_spec,
86 pe_working_set_t *data_set);
87 int cli_resource_restart(pcmk__output_t *out, pe_resource_t *rsc,
88 const pe_node_t *node, const char *move_lifetime,
89 int timeout_ms, cib_t *cib, int cib_options,
90 gboolean promoted_role_only, gboolean force);
91 int cli_resource_move(const pe_resource_t *rsc, const char *rsc_id,
92 const char *host_name, const char *move_lifetime,
93 cib_t *cib, int cib_options, pe_working_set_t *data_set,
94 gboolean promoted_role_only, gboolean force);
95 crm_exit_t cli_resource_execute_from_params(pcmk__output_t *out, const char *rsc_name,
96 const char *rsc_class, const char *rsc_prov,
97 const char *rsc_type, const char *rsc_action,
98 GHashTable *params, GHashTable *override_hash,
99 int timeout_ms, int resource_verbose,
100 gboolean force, int check_level);
101 crm_exit_t cli_resource_execute(pe_resource_t *rsc, const char *requested_name,
102 const char *rsc_action, GHashTable *override_hash,
103 int timeout_ms, cib_t *cib, pe_working_set_t *data_set,
104 int resource_verbose, gboolean force, int check_level);
105
106 int cli_resource_update_attribute(pe_resource_t *rsc, const char *requested_name,
107 const char *attr_set, const char *attr_set_type,
108 const char *attr_id, const char *attr_name,
109 const char *attr_value, gboolean recursive,
110 cib_t *cib, int cib_options, gboolean force);
111 int cli_resource_delete_attribute(pe_resource_t *rsc, const char *requested_name,
112 const char *attr_set, const char *attr_set_type,
113 const char *attr_id, const char *attr_name,
114 cib_t *cib, int cib_options, gboolean force);
115
116 int update_working_set_xml(pe_working_set_t *data_set, xmlNode **xml);
117 int wait_till_stable(pcmk__output_t *out, int timeout_ms, cib_t * cib);
118
119 bool resource_is_running_on(pe_resource_t *rsc, const char *host);
120
121 void crm_resource_register_messages(pcmk__output_t *out);