10 #ifndef __PCMK_SERVICES__    11 #  define __PCMK_SERVICES__    28 #  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"    51 #define PCMK_OCF_REASON_PREFIX "ocf-exit-reason:"    54 #define PCMK_DEFAULT_AGENT_VERSION "0.1"    94 #if !defined(PCMK_ALLOW_DEPRECATED) || (PCMK_ALLOW_DEPRECATED == 1)   254                                       const char *provider, 
const char *agent,
   255                                       const char *
action, guint interval_ms,
   256                                       int timeout , GHashTable *params,
   310                                    int timeout, GHashTable *params,
   311                                    int sequence, 
void *cb_data);
   318     static inline const char *services_ocf_exitcode_str(
enum ocf_exitcode code) {
   325                 return "invalid parameter";
   327                 return "unimplemented feature";
   329                 return "insufficient privileges";
   331                 return "not installed";
   333                 return "not configured";
   335                 return "not running";
   339                 return "promoted (failed)";
   341                 return "OCF_DEGRADED";
   343                 return "promoted (degraded)";
   345 #if !defined(PCMK_ALLOW_DEPRECATED) || (PCMK_ALLOW_DEPRECATED == 1)   347                 return "not supported (DEPRECATED STATUS)";
   349                 return "cancelled (DEPRECATED STATUS)";
   351                 return "other error (DEPRECATED STATUS)";
   353                 return "interrupted by signal (DEPRECATED STATUS)";
   355                 return "pending (DEPRECATED STATUS)";
   357                 return "timeout (DEPRECATED STATUS)";
   364 #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. 
 
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 *))
 
char * provider
Resource provider for resource actions that require it, otherwise NULL. 
 
char * stderr_data
Action stderr (set by library)