10 #ifndef PCMK__CRM_SERVICES__H 11 # define PCMK__CRM_SERVICES__H 19 # include <sys/types.h> 37 # define SYSTEMCTL "/bin/systemctl" 44 #define PCMK_OCF_REASON_PREFIX "ocf-exit-reason:" 47 #define PCMK_DEFAULT_AGENT_VERSION "0.1" 85 #if !defined(PCMK_ALLOW_DEPRECATED) || (PCMK_ALLOW_DEPRECATED == 1) 187 gboolean executable);
253 const char *provider,
const char *agent,
254 const char *
action, guint interval_ms,
255 int timeout, GHashTable *params,
365 int timeout, GHashTable *params,
366 int sequence,
void *cb_data);
373 static inline const char *services_ocf_exitcode_str(
enum ocf_exitcode code) {
380 return "invalid parameter";
382 return "unimplemented feature";
384 return "insufficient privileges";
386 return "not installed";
388 return "not configured";
390 return "not running";
394 return "promoted (failed)";
396 return "OCF_DEGRADED";
398 return "promoted (degraded)";
400 #if !defined(PCMK_ALLOW_DEPRECATED) || (PCMK_ALLOW_DEPRECATED == 1) 402 return "not supported (DEPRECATED STATUS)";
404 return "cancelled (DEPRECATED STATUS)";
406 return "other error (DEPRECATED STATUS)";
408 return "interrupted by signal (DEPRECATED STATUS)";
410 return "pending (DEPRECATED STATUS)";
412 return "timeout (DEPRECATED STATUS)";
419 #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)
API related to resource agents.
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)
Reschedule a recurring action for immediate execution.
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[])
Request execution of an arbitrary command.
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)
Check whether a resource agent exists on the local host.
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 *))
Request asynchronous execution of an action.
char * provider
Resource provider for resource actions that require it, otherwise NULL.
char * stderr_data
Action stderr (set by library)