25 #ifndef __PCMK_SERVICES__
26 # define __PCMK_SERVICES__
36 # include <sys/types.h>
39 # define OCF_ROOT_DIR "/usr/lib/ocf"
43 # define LSB_ROOT_DIR "/etc/init.d"
48 # define SYSTEMCTL "/bin/systemctl"
52 # ifndef SERVICE_SCRIPT
53 # define SERVICE_SCRIPT "/sbin/service"
57 #define PCMK_RESOURCE_CLASS_OCF "ocf"
58 #define PCMK_RESOURCE_CLASS_SERVICE "service"
59 #define PCMK_RESOURCE_CLASS_LSB "lsb"
60 #define PCMK_RESOURCE_CLASS_SYSTEMD "systemd"
61 #define PCMK_RESOURCE_CLASS_UPSTART "upstart"
62 #define PCMK_RESOURCE_CLASS_HB "heartbeat"
63 #define PCMK_RESOURCE_CLASS_NAGIOS "nagios"
64 #define PCMK_RESOURCE_CLASS_STONITH "stonith"
70 #define PCMK_OCF_REASON_PREFIX "ocf-exit-reason:"
73 #define PCMK_DEFAULT_AGENT_VERSION "0.1"
248 int interval ,
int timeout );
269 const char *provider,
const char *agent,
270 const char *action,
int interval ,
271 int timeout , GHashTable * params,
317 int timeout, GHashTable *params,
318 int sequence,
void *cb_data);
322 static inline const char *services_lrm_status_str(
enum op_status status) {
332 default:
return "UNKNOWN!";
336 static inline const char *services_ocf_exitcode_str(
enum ocf_exitcode code) {
341 return "unknown error";
343 return "invalid parameter";
345 return "unimplemented feature";
347 return "insufficient privileges";
349 return "not installed";
351 return "not configured";
353 return "not running";
357 return "master (failed)";
361 return "OCF_NOT_SUPPORTED";
363 return "OCF_PENDING";
365 return "OCF_CANCELLED";
367 return "OCF_TIMEOUT";
369 return "OCF_OTHER_ERROR";
371 return "OCF_DEGRADED";
373 return "OCF_DEGRADED_MASTER";
388 services_get_ocf_exitcode(
const char *action,
int lsb_exitcode)
391 if (action && strcmp(action,
"status") && strcmp(action,
"monitor")) {
399 switch (lsb_exitcode) {
struct svc_action_s svc_action_t
void services_action_free(svc_action_t *op)
svc_action_t * services_action_create(const char *name, const char *action, int interval, int timeout)
const char * resources_find_service_class(const char *agent)
Find first service class that can provide a specified agent.
svc_action_t * resources_action_create(const char *name, const char *standard, const char *provider, const char *agent, const char *action, int interval, int timeout, GHashTable *params, enum svc_action_flags flags)
Create a new resource action.
svc_action_t * services_action_create_generic(const char *exec, const char *args[])
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)
gboolean services_action_cancel(const char *name, const char *action, int interval)
Cancel a recurring action.
GList * resources_list_providers(const char *standard)
Get a list of providers.
int services_action_user(svc_action_t *op, const char *user)
Set the user and group that an action will execute as.
gboolean services_action_kick(const char *name, const char *action, int interval)
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.
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 *))