10 #ifndef __PCMK_SERVICES__
11 # define __PCMK_SERVICES__
28 # include <sys/types.h>
34 # define LSB_ROOT_DIR "/etc/init.d"
39 # define SYSTEMCTL "/bin/systemctl"
43 #define PCMK_RESOURCE_CLASS_OCF "ocf"
44 #define PCMK_RESOURCE_CLASS_SERVICE "service"
45 #define PCMK_RESOURCE_CLASS_LSB "lsb"
46 #define PCMK_RESOURCE_CLASS_SYSTEMD "systemd"
47 #define PCMK_RESOURCE_CLASS_UPSTART "upstart"
48 #define PCMK_RESOURCE_CLASS_NAGIOS "nagios"
49 #define PCMK_RESOURCE_CLASS_STONITH "stonith"
55 #define PCMK_OCF_REASON_PREFIX "ocf-exit-reason:"
58 #define PCMK_DEFAULT_AGENT_VERSION "0.1"
219 guint interval_ms,
int timeout );
240 const char *provider,
const char *agent,
241 const char *
action, guint interval_ms,
242 int timeout , GHashTable *params,
296 int timeout, GHashTable *params,
297 int sequence,
void *cb_data);
301 static inline const char *services_lrm_status_str(
enum op_status status) {
313 default:
return "UNKNOWN!";
317 static inline const char *services_ocf_exitcode_str(
enum ocf_exitcode code) {
324 return "invalid parameter";
326 return "unimplemented feature";
328 return "insufficient privileges";
330 return "not installed";
332 return "not configured";
334 return "not running";
338 return "promoted (failed)";
342 return "OCF_NOT_SUPPORTED";
344 return "OCF_PENDING";
346 return "OCF_CANCELLED";
348 return "OCF_TIMEOUT";
350 return "OCF_OTHER_ERROR";
352 return "OCF_DEGRADED";
354 return "promoted (degraded)";
369 services_get_ocf_exitcode(
const char *action,
int lsb_exitcode)
372 if (action && strcmp(action,
"status") && strcmp(action,
"monitor")) {
380 switch (lsb_exitcode) {
gboolean services_action_cancel(const char *name, const char *action, guint interval_ms)
Cancel a recurring action.
struct svc_action_s svc_action_t
void services_action_free(svc_action_t *op)
gboolean services_action_kick(const char *name, const char *action, guint interval_ms)
const char * resources_find_service_class(const char *agent)
Find first service class that can provide a specified agent.
svc_action_t * services_action_create(const char *name, const char *action, guint interval_ms, int timeout)
svc_action_t * services_action_create_generic(const char *exec, const char *args[])
gboolean services_action_async_fork_notify(svc_action_t *op, void(*action_callback)(svc_action_t *), void(*action_fork_callback)(svc_action_t *))
svc_action_t * resources_action_create(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)
Create a new resource action.
void services_action_cleanup(svc_action_t *op)
enum svc_action_flags flags
svc_action_private_t * opaque
svc_action_t * services_alert_create(const char *id, const char *exec, int timeout, GHashTable *params, int sequence, void *cb_data)
Create an alert agent action.
gboolean services_action_sync(svc_action_t *op)
GList * resources_list_providers(const char *standard)
Get a list of providers.
Function and executable result codes.
int services_action_user(svc_action_t *op, const char *user)
Set the user and group that an action will execute as.
GList * resources_list_standards(void)
GList * get_directory_list(const char *root, gboolean files, gboolean executable)
Get a list of files or directories in a given path.
gboolean resources_agent_exists(const char *standard, const char *provider, const char *agent)
GList * resources_list_agents(const char *standard, const char *provider)
Get a list of resource agents.
gboolean services_alert_async(svc_action_t *action, void(*cb)(svc_action_t *op))
Execute an alert agent action.
GList * services_list(void)
gboolean services_action_async(svc_action_t *op, void(*action_callback)(svc_action_t *))