10 #ifndef PCMK__CRM_SERVICES__H 11 # define PCMK__CRM_SERVICES__H 19 # include <sys/types.h> 35 # define SYSTEMCTL "/bin/systemctl" 39 #define PCMK_RESOURCE_CLASS_OCF "ocf" 40 #define PCMK_RESOURCE_CLASS_SERVICE "service" 41 #define PCMK_RESOURCE_CLASS_LSB "lsb" 42 #define PCMK_RESOURCE_CLASS_SYSTEMD "systemd" 43 #define PCMK_RESOURCE_CLASS_UPSTART "upstart" 44 #define PCMK_RESOURCE_CLASS_NAGIOS "nagios" 45 #define PCMK_RESOURCE_CLASS_STONITH "stonith" 46 #define PCMK_RESOURCE_CLASS_ALERT "alert" 52 #define PCMK_OCF_REASON_PREFIX "ocf-exit-reason:" 55 #define PCMK_DEFAULT_AGENT_VERSION "0.1" 95 #if !defined(PCMK_ALLOW_DEPRECATED) || (PCMK_ALLOW_DEPRECATED == 1) 255 const char *provider,
const char *agent,
256 const char *
action, guint interval_ms,
257 int timeout , GHashTable *params,
366 int timeout, GHashTable *params,
367 int sequence,
void *cb_data);
374 static inline const char *services_ocf_exitcode_str(
enum ocf_exitcode code) {
381 return "invalid parameter";
383 return "unimplemented feature";
385 return "insufficient privileges";
387 return "not installed";
389 return "not configured";
391 return "not running";
395 return "promoted (failed)";
397 return "OCF_DEGRADED";
399 return "promoted (degraded)";
401 #if !defined(PCMK_ALLOW_DEPRECATED) || (PCMK_ALLOW_DEPRECATED == 1) 403 return "not supported (DEPRECATED STATUS)";
405 return "cancelled (DEPRECATED STATUS)";
407 return "other error (DEPRECATED STATUS)";
409 return "interrupted by signal (DEPRECATED STATUS)";
411 return "pending (DEPRECATED STATUS)";
413 return "timeout (DEPRECATED STATUS)";
420 #if !defined(PCMK_ALLOW_DEPRECATED) || (PCMK_ALLOW_DEPRECATED == 1) gboolean services_action_cancel(const char *name, const char *action, guint interval_ms)
Cancel a recurring action.
int rc
Exit status of action (set by library upon completion)
struct svc_action_s svc_action_t
Object for executing external actions.
ocf_exitcode
Exit status codes for resource agents.
Service failed and possibly in promoted role.
void services_action_free(svc_action_t *op)
guint interval_ms
Action interval for recurring resource actions, otherwise 0.
Service active and promoted.
char * standard
Resource standard for resource actions, otherwise NULL.
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_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 *))
Run an action asynchronously, with callback after process is forked.
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.
char * rsc
XML ID of resource being executed for resource actions, otherwise NULL.
enum ocf_exitcode services_result2ocf(const char *standard, const char *action, int exit_status)
Service promoted but more likely to fail soon.
int timeout
Action timeout (in milliseconds)
void services_action_cleanup(svc_action_t *op)
enum svc_action_flags flags
Flag group of enum svc_action_flags.
svc_action_private_t * opaque
This field should be treated as internal to Pacemaker.
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)
Parameter invalid (in local context)
char * stdout_data
Action stdout (set by library)
Parameter invalid (inherently)
Object for executing external actions.
char * agent
Resource agent name for resource actions, otherwise NULL.
GList * resources_list_providers(const char *standard)
Get a list of providers.
Dependencies not available locally.
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.
Requested action not implemented.
Service active but more likely to fail soon.
char * action
Name of action being executed for resource actions, otherwise NULL.
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.
int status
Execution status (enum pcmk_exec_status set by library)
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.
void * cb_data
For caller's use (not used by library)
gboolean services_action_async(svc_action_t *op, void(*action_callback)(svc_action_t *))
Run an action asynchronously.
char * provider
Resource provider for resource actions that require it, otherwise NULL.
char * stderr_data
Action stderr (set by library)