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" 332 static inline const char *services_lrm_status_str(
enum op_status status) {
342 default:
return "UNKNOWN!";
346 static inline const char *services_ocf_exitcode_str(
enum ocf_exitcode code) {
351 return "unknown error";
353 return "invalid parameter";
355 return "unimplemented feature";
357 return "insufficient privileges";
359 return "not installed";
361 return "not configured";
363 return "not running";
367 return "master (failed)";
371 return "OCF_NOT_SUPPORTED";
373 return "OCF_PENDING";
375 return "OCF_CANCELLED";
377 return "OCF_TIMEOUT";
379 return "OCF_OTHER_ERROR";
381 return "OCF_DEGRADED";
383 return "OCF_DEGRADED_MASTER";
398 services_get_ocf_exitcode(
const char *action,
int lsb_exitcode)
401 if (action && strcmp(action,
"status") && strcmp(action,
"monitor")) {
409 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[])
gboolean services_action_async_fork_notify(svc_action_t *op, void(*action_callback)(svc_action_t *), void(*action_fork_callback)(svc_action_t *))
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 *))