1
2
3
4
5
6
7
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
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
58 void cli_resource_print_cts(pcmk__output_t *out, pe_resource_t * rsc);
59 void cli_resource_print_raw(pcmk__output_t *out, pe_resource_t * rsc);
60 void cli_resource_print_cts_constraints(pe_working_set_t * data_set);
61
62 int cli_resource_print(pe_resource_t *rsc, pe_working_set_t *data_set, bool expanded);
63 int cli_resource_print_operations(const char *rsc_id, const char *host_uname,
64 bool active, pe_working_set_t * data_set);
65
66
67 int cli_resource_check(pcmk__output_t *out, cib_t * cib, pe_resource_t *rsc);
68 int cli_resource_fail(pcmk_ipc_api_t *controld_api, const char *host_uname,
69 const char *rsc_id, pe_working_set_t *data_set);
70 GList *cli_resource_search(pe_resource_t *rsc, const char *requested_name,
71 pe_working_set_t *data_set);
72 int cli_resource_delete(pcmk_ipc_api_t *controld_api, const char *host_uname,
73 pe_resource_t *rsc, const char *operation,
74 const char *interval_spec, bool just_failures,
75 pe_working_set_t *data_set, gboolean force);
76 int cli_cleanup_all(pcmk_ipc_api_t *controld_api, const char *node_name,
77 const char *operation, const char *interval_spec,
78 pe_working_set_t *data_set);
79 int cli_resource_restart(pcmk__output_t *out, pe_resource_t *rsc, const char *host,
80 const char *move_lifetime, int timeout_ms, cib_t *cib,
81 int cib_options, gboolean promoted_role_only, gboolean force);
82 int cli_resource_move(pe_resource_t *rsc, const char *rsc_id, const char *host_name,
83 const char *move_lifetime, cib_t *cib, int cib_options,
84 pe_working_set_t *data_set, gboolean promoted_role_only,
85 gboolean force);
86 crm_exit_t cli_resource_execute_from_params(pcmk__output_t *out, const char *rsc_name,
87 const char *rsc_class, const char *rsc_prov,
88 const char *rsc_type, const char *rsc_action,
89 GHashTable *params, GHashTable *override_hash,
90 int timeout_ms, int resource_verbose,
91 gboolean force);
92 crm_exit_t cli_resource_execute(pe_resource_t *rsc, const char *requested_name,
93 const char *rsc_action, GHashTable *override_hash,
94 int timeout_ms, cib_t *cib, pe_working_set_t *data_set,
95 int resource_verbose, gboolean force);
96
97 int cli_resource_update_attribute(pe_resource_t *rsc, const char *requested_name,
98 const char *attr_set, const char *attr_set_type,
99 const char *attr_id, const char *attr_name,
100 const char *attr_value, gboolean recursive,
101 cib_t *cib, int cib_options,
102 pe_working_set_t *data_set, gboolean force);
103 int cli_resource_delete_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 cib_t *cib, int cib_options,
107 pe_working_set_t *data_set, gboolean force);
108
109 int update_working_set_xml(pe_working_set_t *data_set, xmlNode **xml);
110 int wait_till_stable(pcmk__output_t *out, int timeout_ms, cib_t * cib);
111
112 bool resource_is_running_on(pe_resource_t *rsc, const char *host);
113
114 void crm_resource_register_messages(pcmk__output_t *out);