pacemaker
1.1.18-7fdfbbe
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/msg_xml.h>
#include "services_private.h"
Go to the source code of this file.
Macros | |
#define | _GNU_SOURCE |
#define | lsb_metadata_template |
#define | LSB_INITSCRIPT_INFOBEGIN_TAG "### BEGIN INIT INFO" |
#define | LSB_INITSCRIPT_INFOEND_TAG "### END INIT INFO" |
#define | PROVIDES "# Provides:" |
#define | REQ_START "# Required-Start:" |
#define | REQ_STOP "# Required-Stop:" |
#define | SHLD_START "# Should-Start:" |
#define | SHLD_STOP "# Should-Stop:" |
#define | DFLT_START "# Default-Start:" |
#define | DFLT_STOP "# Default-Stop:" |
#define | SHORT_DSCR "# Short-Description:" |
#define | DESCRIPTION "# Description:" |
#define | lsb_meta_helper_free_value(m) |
#define | DESC_MAX 2048 |
Functions | |
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. More... | |
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. More... | |
svc_action_t * | services_action_create_generic (const char *exec, const char *args[]) |
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) |
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, int interval) |
Cancel a recurring action. More... | |
gboolean | services_action_kick (const char *name, const char *action, int interval) |
void | services_add_inflight_op (svc_action_t *op) |
void | services_untrack_op (svc_action_t *op) |
gboolean | services_action_async (svc_action_t *op, void(*action_callback)(svc_action_t *)) |
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 * | services_list (void) |
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... | |
#define _GNU_SOURCE |
Definition at line 11 of file services.c.
#define DESC_MAX 2048 |
Definition at line 986 of file services.c.
#define DESCRIPTION "# Description:" |
Definition at line 956 of file services.c.
#define DFLT_START "# Default-Start:" |
Definition at line 953 of file services.c.
#define DFLT_STOP "# Default-Stop:" |
Definition at line 954 of file services.c.
#define LSB_INITSCRIPT_INFOBEGIN_TAG "### BEGIN INIT INFO" |
Definition at line 946 of file services.c.
#define LSB_INITSCRIPT_INFOEND_TAG "### END INIT INFO" |
Definition at line 947 of file services.c.
#define lsb_meta_helper_free_value | ( | m | ) |
Definition at line 958 of file services.c.
#define lsb_metadata_template |
Definition at line 912 of file services.c.
#define PROVIDES "# Provides:" |
Definition at line 948 of file services.c.
#define REQ_START "# Required-Start:" |
Definition at line 949 of file services.c.
#define REQ_STOP "# Required-Stop:" |
Definition at line 950 of file services.c.
#define SHLD_START "# Should-Start:" |
Definition at line 951 of file services.c.
#define SHLD_STOP "# Should-Stop:" |
Definition at line 952 of file services.c.
#define SHORT_DSCR "# Short-Description:" |
Definition at line 955 of file services.c.
gboolean cancel_recurring_action | ( | svc_action_t * | op | ) |
Definition at line 615 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 1351 of file services.c.
gboolean is_op_blocked | ( | const char * | rsc | ) |
Definition at line 856 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, | ||
int | interval, | ||
int | timeout, | ||
GHashTable * | params, | ||
enum svc_action_flags | flags | ||
) |
Create a new resource action.
[in] | name | name of resource |
[in] | standard | resource agent standard (ocf, lsb, etc.) |
[in] | provider | resource agent provider |
[in] | agent | resource agent name |
[in] | action | action (start, stop, monitor, etc.) |
[in] | interval | how often to repeat this action, in milliseconds (if 0, execute only once) |
[in] | timeout | consider action failed if it does not complete in this many milliseconds |
[in] | params | action parameters |
Definition at line 165 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 70 of file services.c.
GList* resources_list_agents | ( | const char * | standard, |
const char * | provider | ||
) |
Get a list of resource agents.
[in] | standard | list agents using this standard (e.g. ocf, lsb, etc.) (or NULL for all) |
[in] | provider | list agents from this provider (or NULL for all) |
Definition at line 1425 of file services.c.
GList* resources_list_providers | ( | const char * | standard | ) |
Get a list of providers.
[in] | standard | list providers of this standard (e.g. ocf, lsb, etc.) |
Definition at line 1415 of file services.c.
GList* resources_list_standards | ( | void | ) |
Get list of available standards
Definition at line 1371 of file services.c.
gboolean services_action_async | ( | svc_action_t * | op, |
void(*)(svc_action_t *) | action_callback | ||
) |
Run an action asynchronously.
[in] | op | services action data |
[in] | action_callback | callback for when the action completes |
TRUE | succesfully started execution |
FALSE | failed to start execution, no callback will be received |
Definition at line 827 of file services.c.
gboolean services_action_cancel | ( | const char * | name, |
const char * | action, | ||
int | interval | ||
) |
Cancel a recurring action.
[in] | name | Name of resource that operation is for |
[in] | action | Name of operation to cancel |
[in] | interval | Interval of operation to cancel |
Definition at line 641 of file services.c.
void services_action_cleanup | ( | svc_action_t * | op | ) |
Definition at line 527 of file services.c.
svc_action_t* services_action_create | ( | const char * | name, |
const char * | action, | ||
int | interval, | ||
int | timeout | ||
) |
Definition at line 52 of file services.c.
svc_action_t* services_action_create_generic | ( | const char * | exec, |
const char * | args[] | ||
) |
Utilize services API to execute 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 | command to execute |
[in] | args | arguments to the command, NULL terminated |
Definition at line 367 of file services.c.
void services_action_free | ( | svc_action_t * | op | ) |
Definition at line 563 of file services.c.
gboolean services_action_kick | ( | const char * | name, |
const char * | action, | ||
int | interval | ||
) |
Kick a recurring action so it is scheduled immediately for re-execution
Definition at line 704 of file services.c.
gboolean services_action_sync | ( | svc_action_t * | op | ) |
Definition at line 1316 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] | action | Action to modify |
[in] | user | Name of user to execute action as |
[in] | group | Name of group to execute action as |
Definition at line 435 of file services.c.
void services_add_inflight_op | ( | svc_action_t * | op | ) |
Definition at line 795 of file services.c.
gboolean services_alert_async | ( | svc_action_t * | action, |
void(*)(svc_action_t *op) | cb | ||
) |
Execute an alert agent action.
[in] | action | Action to execute |
[in] | cb | Function to call when action completes |
Definition at line 482 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 405 of file services.c.
GList* services_list | ( | void | ) |
Get a list of services
Definition at line 1357 of file services.c.
void services_untrack_op | ( | svc_action_t * | op | ) |
Definition at line 816 of file services.c.