File: services_internal.h

package info (click to toggle)
pacemaker 3.0.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 68,576 kB
  • sloc: xml: 160,564; ansic: 143,744; python: 5,670; sh: 2,969; makefile: 2,426
file content (67 lines) | stat: -rw-r--r-- 2,722 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/*
 * Copyright 2010-2025 the Pacemaker project contributors
 *
 * The version control history for this file may have further details.
 *
 * This source code is licensed under the GNU Lesser General Public License
 * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY.
 */

#ifndef PCMK__CRM_SERVICES_INTERNAL__H
#define PCMK__CRM_SERVICES_INTERNAL__H

#include <crm/common/results_internal.h>    // pcmk__action_result_t
#include <crm/services.h>                   // svc_action_t

#ifdef __cplusplus
extern "C" {
#endif

/*!
 * \brief Create a new resource action
 *
 * \param[in]     name        Name of resource
 * \param[in]     standard    Resource agent standard
 * \param[in]     provider    Resource agent provider
 * \param[in]     agent       Resource agent name
 * \param[in]     action      Name of action
 * \param[in]     interval_ms How often to repeat action (if 0, execute once)
 * \param[in]     timeout     Error if not complete within this time (ms)
 * \param[in,out] params      Action parameters
 * \param[in]     flags       Group of enum svc_action_flags
 *
 * \return NULL if not enough memory, otherwise newly allocated action instance
 *         (if its rc member is not PCMK_OCF_UNKNOWN, the action is invalid)
 *
 * \note This function assumes ownership of (and may free) \p params.
 * \note The caller is responsible for freeing the return value using
 *       services_action_free().
 */
svc_action_t *services__create_resource_action(const char *name,
                                               const char *standard,
                                               const char *provider,
                                               const char *agent,
                                               const char *action,
                                               guint interval_ms,
                                               int timeout, GHashTable *params,
                                               enum svc_action_flags flags);

const char *services__exit_reason(const svc_action_t *action);
char *services__grab_stdout(svc_action_t *action);
char *services__grab_stderr(svc_action_t *action);

void services__set_result(svc_action_t *action, int agent_status,
                          enum pcmk_exec_status exec_status,
                          const char *exit_reason);
void services__copy_result(const svc_action_t *action,
                           pcmk__action_result_t *result);

void services__format_result(svc_action_t *action, int agent_status,
                             enum pcmk_exec_status exec_status,
                             const char *format, ...) G_GNUC_PRINTF(4, 5);

#ifdef __cplusplus
}
#endif

#endif // PCMK__CRM_SERVICES_INTERNAL__H