| pacemaker
    2.1.7-0f7f88312f
    Scalable High-Availability cluster resource manager | 
#include <crm_internal.h>#include <sys/types.h>#include <sys/stat.h>#include <stdio.h>#include <errno.h>#include <unistd.h>#include <dirent.h>#include <fcntl.h>#include <crm/crm.h>#include <crm/common/mainloop.h>#include <crm/services.h>#include <crm/services_internal.h>#include <crm/stonith-ng.h>#include <crm/msg_xml.h>#include "services_private.h"#include "services_ocf.h"#include "services_lsb.h"
Go to the source code of this file.
| Macros | |
| #define | _GNU_SOURCE | 
| Functions | |
| const char * | resources_find_service_class (const char *agent) | 
| Find first service class that can provide a specified agent.  More... | |
| svc_action_t * | services__create_resource_action (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.  More... | |
| 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.  More... | |
| svc_action_t * | services_action_create_generic (const char *exec, const char *args[]) | 
| Request execution of an arbitrary command.  More... | |
| 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.  More... | |
| int | services_action_user (svc_action_t *op, const char *user) | 
| Set the user and group that an action will execute as.  More... | |
| gboolean | services_alert_async (svc_action_t *action, void(*cb)(svc_action_t *op)) | 
| Execute an alert agent action.  More... | |
| void | services_action_cleanup (svc_action_t *op) | 
| enum ocf_exitcode | services_result2ocf (const char *standard, const char *action, int exit_status) | 
| void | services_action_free (svc_action_t *op) | 
| gboolean | cancel_recurring_action (svc_action_t *op) | 
| gboolean | services_action_cancel (const char *name, const char *action, guint interval_ms) | 
| Cancel a recurring action.  More... | |
| gboolean | services_action_kick (const char *name, const char *action, guint interval_ms) | 
| Reschedule a recurring action for immediate execution.  More... | |
| void | services_add_inflight_op (svc_action_t *op) | 
| void | services_untrack_op (const svc_action_t *op) | 
| 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.  More... | |
| gboolean | services_action_async (svc_action_t *op, void(*action_callback)(svc_action_t *)) | 
| Request asynchronous execution of an action.  More... | |
| gboolean | is_op_blocked (const char *rsc) | 
| gboolean | services_action_sync (svc_action_t *op) | 
| GList * | get_directory_list (const char *root, gboolean files, gboolean executable) | 
| Get a list of files or directories in a given path.  More... | |
| GList * | resources_list_standards (void) | 
| GList * | resources_list_providers (const char *standard) | 
| Get a list of providers.  More... | |
| GList * | resources_list_agents (const char *standard, const char *provider) | 
| Get a list of resource agents.  More... | |
| gboolean | resources_agent_exists (const char *standard, const char *provider, const char *agent) | 
| Check whether a resource agent exists on the local host.  More... | |
| void | services__set_result (svc_action_t *action, int agent_status, enum pcmk_exec_status exec_status, const char *reason) | 
| void | services__format_result (svc_action_t *action, int agent_status, enum pcmk_exec_status exec_status, const char *format,...) | 
| void | services__set_cancelled (svc_action_t *action) | 
| const char * | services__action_kind (const svc_action_t *action) | 
| const char * | services__exit_reason (const svc_action_t *action) | 
| char * | services__grab_stdout (svc_action_t *action) | 
| char * | services__grab_stderr (svc_action_t *action) | 
| #define _GNU_SOURCE | 
Definition at line 13 of file services.c.
| gboolean cancel_recurring_action | ( | svc_action_t * | op | ) | 
Definition at line 638 of file services.c.
| GList* get_directory_list | ( | const char * | root, | 
| gboolean | files, | ||
| gboolean | executable | ||
| ) | 
Get a list of files or directories in a given path.
| [in] | root | Full path to a directory to read | 
| [in] | files | Return list of files if TRUE or directories if FALSE | 
| [in] | executable | If TRUE and files is TRUE, only return executable files | 
Definition at line 1055 of file services.c.
| gboolean is_op_blocked | ( | const char * | rsc | ) | 
Definition at line 910 of file services.c.
| 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.
| [in] | name | Name of resource that action is for | 
| [in] | standard | Resource agent standard | 
| [in] | provider | Resource agent provider | 
| [in] | agent | Resource agent name | 
| [in] | action | Name of action to create | 
| [in] | interval_ms | How often to repeat action (if 0, execute once) | 
| [in] | timeout | Error if not complete within this time (ms) | 
| [in,out] | params | Action parameters | 
| [in] | flags | Group of enum svc_action_flags | 
params. Definition at line 335 of file services.c.
| gboolean resources_agent_exists | ( | const char * | standard, | 
| const char * | provider, | ||
| const char * | agent | ||
| ) | 
Check whether a resource agent exists on the local host.
| [in] | standard | Resource agent standard of agent to check | 
| [in] | provider | Provider of agent to check (or NULL) | 
| [in] | agent | Name of agent to check | 
Definition at line 1175 of file services.c.
| const char* resources_find_service_class | ( | const char * | agent | ) | 
Find first service class that can provide a specified agent.
| [in] | agent | Name of agent to search for | 
Definition at line 72 of file services.c.
| GList* resources_list_agents | ( | const char * | standard, | 
| const char * | provider | ||
| ) | 
Get a list of resource agents.
| [in] | standard | List agents of this standard (or NULL for all) | 
| [in] | provider | List agents of this provider (or NULL for all) | 
Definition at line 1119 of file services.c.
| GList* resources_list_providers | ( | const char * | standard | ) | 
Get a list of providers.
| [in] | standard | List providers of this resource agent standard | 
Definition at line 1109 of file services.c.
| GList* resources_list_standards | ( | void | ) | 
Get list of available standards
Definition at line 1061 of file services.c.
| const char* services__action_kind | ( | const svc_action_t * | action | ) | 
Definition at line 1352 of file services.c.
| svc_action_t* services__create_resource_action | ( | 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.
| [in] | name | Name of resource | 
| [in] | standard | Resource agent standard | 
| [in] | provider | Resource agent provider | 
| [in] | agent | Resource agent name | 
| [in] | action | Name of action | 
| [in] | interval_ms | How often to repeat action (if 0, execute once) | 
| [in] | timeout | Error if not complete within this time (ms) | 
| [in,out] | params | Action parameters | 
| [in] | flags | Group of enum svc_action_flags | 
params. Definition at line 254 of file services.c.
| const char* services__exit_reason | ( | const svc_action_t * | action | ) | 
Definition at line 1376 of file services.c.
| void services__format_result | ( | svc_action_t * | action, | 
| int | agent_status, | ||
| enum pcmk_exec_status | exec_status, | ||
| const char * | format, | ||
| ... | |||
| ) | 
Definition at line 1300 of file services.c.
| char* services__grab_stderr | ( | svc_action_t * | action | ) | 
Definition at line 1411 of file services.c.
| char* services__grab_stdout | ( | svc_action_t * | action | ) | 
Definition at line 1392 of file services.c.
| void services__set_cancelled | ( | svc_action_t * | action | ) | 
Definition at line 1334 of file services.c.
| void services__set_result | ( | svc_action_t * | action, | 
| int | agent_status, | ||
| enum pcmk_exec_status | exec_status, | ||
| const char * | reason | ||
| ) | 
Definition at line 1271 of file services.c.
| gboolean services_action_async | ( | svc_action_t * | op, | 
| void(*)(svc_action_t *) | action_callback | ||
| ) | 
Request asynchronous execution of an action.
| [in,out] | op | Action to execute | 
| [in] | action_callback | Function to call when the action completes (if NULL, any previously set callback will continue to be used) | 
| TRUE | if the caller should not free or otherwise use opagain, because one of these conditions is true: | 
op is NULL.action_callback has not been called (it will be called when the action completes).op and has been re-initiated asynchronously, and op has been freed.op will be blocked until it completes.action_callback has been called, and op has been freed.| FALSE | if  is still valid, because the action cannot be initiated, and is a recurring action that is not being cancelled. action_callbackhas been called, and a timer has been set for the next invocation ofop. | 
Definition at line 901 of file services.c.
| gboolean services_action_async_fork_notify | ( | svc_action_t * | op, | 
| void(*)(svc_action_t *) | action_callback, | ||
| void(*)(svc_action_t *) | action_fork_callback | ||
| ) | 
Run an action asynchronously, with callback after process is forked.
| [in,out] | op | Action to run | 
| [in] | action_callback | Function to call when action completes (if NULL, any previously set callback will continue to be used) | 
| [in] | action_fork_callback | Function to call after child process is forked for action (if NULL, any previously set callback will continue to be used) | 
| TRUE | if the caller should not free or otherwise use opagain, because one of these conditions is true: | 
op is NULL.action_fork_callback has been called, but action_callback has not (it will be called when the action completes).op and has been re-initiated asynchronously, and op has been freed.op will be blocked until it completes.action_fork_callback has not been called, but action_callback has, and op has been freed.| FALSE | if  is still valid, because the action cannot be initiated, and is a recurring action that is not being cancelled. action_fork_callbackhas not been called, butaction_callbackhas, and a timer has been set for the next invocation ofop. | 
Definition at line 867 of file services.c.
| gboolean services_action_cancel | ( | const char * | name, | 
| const char * | action, | ||
| guint | interval_ms | ||
| ) | 
Cancel a recurring action.
| [in] | name | Name of resource that operation is for | 
| [in] | action | Name of operation to cancel | 
| [in] | interval_ms | Interval of operation to cancel | 
Definition at line 664 of file services.c.
| void services_action_cleanup | ( | svc_action_t * | op | ) | 
Definition at line 501 of file services.c.
| svc_action_t* services_action_create_generic | ( | const char * | exec, | 
| const char * | args[] | ||
| ) | 
Request execution of an arbitrary command.
This API has useful infrastructure in place to be able to run a command in the background and get notified via a callback when the command finishes.
| [in] | exec | Full path to command executable | 
| [in] | args | NULL-terminated list of arguments to pass to command | 
Definition at line 356 of file services.c.
| void services_action_free | ( | svc_action_t * | op | ) | 
Definition at line 585 of file services.c.
| gboolean services_action_kick | ( | const char * | name, | 
| const char * | action, | ||
| guint | interval_ms | ||
| ) | 
Reschedule a recurring action for immediate execution.
| [in] | name | Name of resource that action is for | 
| [in] | action | Action's name | 
| [in] | interval_ms | Action's interval (in milliseconds) | 
Definition at line 732 of file services.c.
| gboolean services_action_sync | ( | svc_action_t * | op | ) | 
Definition at line 1020 of file services.c.
| int services_action_user | ( | svc_action_t * | op, | 
| const char * | user | ||
| ) | 
Set the user and group that an action will execute as.
| [in,out] | op | Action to modify | 
| [in] | user | Name of user to execute action as | 
| [in] | group | Name of group to execute action as | 
Definition at line 445 of file services.c.
| void services_add_inflight_op | ( | svc_action_t * | op | ) | 
Definition at line 835 of file services.c.
| gboolean services_alert_async | ( | svc_action_t * | action, | 
| void(*)(svc_action_t *op) | cb | ||
| ) | 
Execute an alert agent action.
| [in,out] | action | Action to execute | 
| [in] | cb | Function to call when action completes | 
Definition at line 465 of file services.c.
| 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.
| [in] | id | Alert ID | 
| [in] | exec | Path to alert agent executable | 
| [in] | timeout | Action timeout | 
| [in] | params | Parameters to use with action | 
| [in] | sequence | Action sequence number | 
| [in] | cb_data | Data to pass to callback function | 
Definition at line 413 of file services.c.
| enum ocf_exitcode services_result2ocf | ( | const char * | standard, | 
| const char * | action, | ||
| int | exit_status | ||
| ) | 
Definition at line 550 of file services.c.
| void services_untrack_op | ( | const svc_action_t * | op | ) | 
Definition at line 856 of file services.c.
 1.8.14
 1.8.14